Verified Commit cdbf2a44 authored by James Teh's avatar James Teh Committed by ma1
Browse files

Bug 2047957: Ensure cached line start offsets are valid. a=RyanVM DONTBUILD

parent bfbe3d3a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -868,7 +868,12 @@ TextLeafPoint TextLeafPoint::FindLineStartSameRemoteAcc(
  if (aDirection == eDirPrevious) {
    --index;
  }
  return TextLeafPoint(mAcc, lines->ElementAt(index));
  int32_t offset = lines->ElementAt(index);
  if (MOZ_UNLIKELY(offset < 0 || static_cast<uint32_t>(offset) >
                                     nsAccUtils::TextLength(mAcc))) {
    return TextLeafPoint();
  }
  return TextLeafPoint(mAcc, offset);
}

TextLeafPoint TextLeafPoint::FindLineStartSameAcc(