Bug 1343552 part 2 - Record attempted misuse of gfxSkipCharsIterator via a gfxCriticalError.
authorJonathan Kew <jkew@mozilla.com>
Mon, 06 Mar 2017 17:31:01 +0000
changeset 346793 80d9e84735e7a19fb2c064605821065b38946a4d
parent 346792 0f7465d1f1bba6ec2321793061f6a1959b1b40b4
child 346794 96c0f515063886f92b0b26f112df573f6a2f5246
push id31479
push userkwierso@gmail.com
push dateFri, 10 Mar 2017 00:33:39 +0000
treeherdermozilla-central@35398cae65c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1343552
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1343552 part 2 - Record attempted misuse of gfxSkipCharsIterator via a gfxCriticalError. MozReview-Commit-ID: CayLp1dGSnq
gfx/thebes/gfxSkipChars.cpp
--- a/gfx/thebes/gfxSkipChars.cpp
+++ b/gfx/thebes/gfxSkipChars.cpp
@@ -14,18 +14,22 @@ struct SkippedRangeStartComparator
         return (mOffset < aRange.Start()) ? -1 : 1;
     }
 };
 
 void
 gfxSkipCharsIterator::SetOriginalOffset(int32_t aOffset)
 {
     aOffset += mOriginalStringToSkipCharsOffset;
-    NS_ASSERTION(uint32_t(aOffset) <= mSkipChars->mCharCount,
-                 "Invalid offset");
+    if (MOZ_UNLIKELY(uint32_t(aOffset) > mSkipChars->mCharCount)) {
+        gfxCriticalError() <<
+            "invalid offset " << aOffset <<
+            " for gfxSkipChars length " << mSkipChars->mCharCount;
+        aOffset = mSkipChars->mCharCount;
+    }
 
     mOriginalStringOffset = aOffset;
 
     const uint32_t rangeCount = mSkipChars->mRanges.Length();
     if (rangeCount == 0) {
         mSkippedStringOffset = aOffset;
         return;
     }