Title: [246653] trunk/Source/WebCore
Revision
246653
Author
rn...@webkit.org
Date
2019-06-20 14:42:50 -0700 (Thu, 20 Jun 2019)

Log Message

REGRESSION(r245912): Crash in TextIterator::range via visiblePositionForIndexUsingCharacterIterator
https://bugs.webkit.org/show_bug.cgi?id=199061

Reviewed by Wenson Hsieh.

Avoid calling CharacterIterator::range when it's at the end. Otherwise, we'd crash with null pointer dereferencing.

Unfortunately no new tests since we don't have any reproducible test case.

* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246652 => 246653)


--- trunk/Source/WebCore/ChangeLog	2019-06-20 20:39:29 UTC (rev 246652)
+++ trunk/Source/WebCore/ChangeLog	2019-06-20 21:42:50 UTC (rev 246653)
@@ -1,3 +1,17 @@
+2019-06-20  Ryosuke Niwa  <rn...@webkit.org>
+
+        REGRESSION(r245912): Crash in TextIterator::range via visiblePositionForIndexUsingCharacterIterator
+        https://bugs.webkit.org/show_bug.cgi?id=199061
+
+        Reviewed by Wenson Hsieh.
+
+        Avoid calling CharacterIterator::range when it's at the end. Otherwise, we'd crash with null pointer dereferencing.
+
+        Unfortunately no new tests since we don't have any reproducible test case.
+
+        * editing/Editing.cpp:
+        (WebCore::visiblePositionForIndexUsingCharacterIterator):
+
 2019-06-20  Brent Fulgham  <bfulg...@apple.com>
 
         Resolve frequent crashes in topPrivatelyControlledDomain

Modified: trunk/Source/WebCore/editing/Editing.cpp (246652 => 246653)


--- trunk/Source/WebCore/editing/Editing.cpp	2019-06-20 20:39:29 UTC (rev 246652)
+++ trunk/Source/WebCore/editing/Editing.cpp	2019-06-20 21:42:50 UTC (rev 246653)
@@ -1127,7 +1127,8 @@
         auto range = it.range();
         if (range->startPosition() == range->endPosition()) {
             it.advance(1);
-            return VisiblePosition(it.range()->startPosition());
+            if (!it.atEnd())
+                return VisiblePosition(it.range()->startPosition());
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to