зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675172 - Prevent an infinite loop when finding the line end boundary for an offset of 0, r=Jamie
Use a safer looping method, walking forward from aOffset to tmpOffset to prevent wrapping around at 0. Differential Revision: https://phabricator.services.mozilla.com/D95826
This commit is contained in:
Родитель
d72d343fad
Коммит
19a10e117a
|
@ -819,14 +819,15 @@ uint32_t HyperTextAccessible::FindLineBoundary(
|
|||
// layout could not find the offset for us. This can happen with certain
|
||||
// inline-block elements.
|
||||
if (nextLineBeginOffset <= aOffset) {
|
||||
// Walk back from the tmpOffset to the offset we started from,
|
||||
// Walk forward from the offset we started from up to tmpOffset,
|
||||
// stopping after a line end character.
|
||||
nextLineBeginOffset = tmpOffset;
|
||||
while (nextLineBeginOffset >= aOffset &&
|
||||
!IsLineEndCharAt(nextLineBeginOffset - 1)) {
|
||||
nextLineBeginOffset--;
|
||||
nextLineBeginOffset = aOffset;
|
||||
while (nextLineBeginOffset < tmpOffset) {
|
||||
if (IsLineEndCharAt(nextLineBeginOffset)) {
|
||||
return nextLineBeginOffset + 1;
|
||||
}
|
||||
nextLineBeginOffset++;
|
||||
}
|
||||
return nextLineBeginOffset;
|
||||
}
|
||||
|
||||
return nextLineBeginOffset;
|
||||
|
|
Загрузка…
Ссылка в новой задаче