Fix Buffer::advance out of bounds access.
This commit fixes a bug in Buffer::advance where it would first access m_lines[-1], and then check whether or not that access would have segfaulted. This commit moves the check to before the segfault would occur.
This commit is contained in:
parent
86bd4efd25
commit
293d46837d
|
@ -575,9 +575,9 @@ BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const
|
||||||
count += coord.column;
|
count += coord.column;
|
||||||
while (count < 0)
|
while (count < 0)
|
||||||
{
|
{
|
||||||
count += m_lines[--line].length();
|
if (--line < 0)
|
||||||
if (line < 0)
|
|
||||||
return {0, 0};
|
return {0, 0};
|
||||||
|
count += m_lines[line].length();
|
||||||
}
|
}
|
||||||
return { line, count };
|
return { line, count };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user