Title: [259766] trunk/Source/WebCore
Revision
259766
Author
[email protected]
Date
2020-04-08 16:59:31 -0700 (Wed, 08 Apr 2020)

Log Message

REGRESSION (r258525): Occasional crashes under TextManipulationController::observeParagraphs
https://bugs.webkit.org/show_bug.cgi?id=210215
<rdar://problem/61362512>

Reviewed by Darin Adler.

In the case where `startOfParagraph` or `endOfParagraph` return a null `Position`, we end up crashing under
TextManipulationController::observeParagraphs while creating `ParagraphContentIterator`, which expects non-null
`Position`s because it dereferences the result of `makeBoundaryPoint`.

Avoid this crash for now by bailing if either the start or end positions are null. Tests to be added in a
followup patch.

* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::observeParagraphs):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259765 => 259766)


--- trunk/Source/WebCore/ChangeLog	2020-04-08 23:50:38 UTC (rev 259765)
+++ trunk/Source/WebCore/ChangeLog	2020-04-08 23:59:31 UTC (rev 259766)
@@ -1,3 +1,21 @@
+2020-04-08  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r258525): Occasional crashes under TextManipulationController::observeParagraphs
+        https://bugs.webkit.org/show_bug.cgi?id=210215
+        <rdar://problem/61362512>
+
+        Reviewed by Darin Adler.
+
+        In the case where `startOfParagraph` or `endOfParagraph` return a null `Position`, we end up crashing under
+        TextManipulationController::observeParagraphs while creating `ParagraphContentIterator`, which expects non-null
+        `Position`s because it dereferences the result of `makeBoundaryPoint`.
+
+        Avoid this crash for now by bailing if either the start or end positions are null. Tests to be added in a
+        followup patch.
+
+        * editing/TextManipulationController.cpp:
+        (WebCore::TextManipulationController::observeParagraphs):
+
 2020-04-08  Kenneth Russell  <[email protected]>
 
         Release WebGLLayer earlier in ~GraphicsContextGLOpenGL

Modified: trunk/Source/WebCore/editing/TextManipulationController.cpp (259765 => 259766)


--- trunk/Source/WebCore/editing/TextManipulationController.cpp	2020-04-08 23:50:38 UTC (rev 259765)
+++ trunk/Source/WebCore/editing/TextManipulationController.cpp	2020-04-08 23:59:31 UTC (rev 259766)
@@ -239,6 +239,9 @@
 
 void TextManipulationController::observeParagraphs(const Position& start, const Position& end)
 {
+    if (start.isNull() || end.isNull())
+        return;
+
     auto document = makeRefPtr(start.document());
     ASSERT(document);
     ParagraphContentIterator iterator { start, end };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to