Title: [247734] trunk/Source/WebCore
Revision
247734
Author
[email protected]
Date
2019-07-23 12:50:17 -0700 (Tue, 23 Jul 2019)

Log Message

Fix crashes in ScrollingStateNode::insertChild()
https://bugs.webkit.org/show_bug.cgi?id=200023
rdar://problem/53265378

Reviewed by Darin Adler.

Crash data suggest that ScrollingStateNode::insertChild() can be passed an index that
is larger than the size of the vector, causing crashes.

Fix defensively by falling back to append() if the passed index is equal to or larger
than the size of the children vector.

* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::insertChild):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247733 => 247734)


--- trunk/Source/WebCore/ChangeLog	2019-07-23 19:32:48 UTC (rev 247733)
+++ trunk/Source/WebCore/ChangeLog	2019-07-23 19:50:17 UTC (rev 247734)
@@ -231,6 +231,23 @@
 
 2019-07-22  Simon Fraser  <[email protected]>
 
+        Fix crashes in ScrollingStateNode::insertChild()
+        https://bugs.webkit.org/show_bug.cgi?id=200023
+        rdar://problem/53265378
+
+        Reviewed by Darin Adler.
+
+        Crash data suggest that ScrollingStateNode::insertChild() can be passed an index that
+        is larger than the size of the vector, causing crashes.
+
+        Fix defensively by falling back to append() if the passed index is equal to or larger
+        than the size of the children vector.
+
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::insertChild):
+
+2019-07-22  Simon Fraser  <[email protected]>
+
         Make some constructors explicit
         https://bugs.webkit.org/show_bug.cgi?id=199981
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (247733 => 247734)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2019-07-23 19:32:48 UTC (rev 247733)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2019-07-23 19:50:17 UTC (rev 247734)
@@ -116,7 +116,12 @@
         m_children = std::make_unique<Vector<RefPtr<ScrollingStateNode>>>();
     }
 
-    m_children->insert(index, WTFMove(childNode));
+    if (index > m_children->size()) {
+        ASSERT_NOT_REACHED();  // Crash data suggest we can get here.
+        m_children->append(WTFMove(childNode));
+    } else
+        m_children->insert(index, WTFMove(childNode));
+    
     setPropertyChanged(ChildNodes);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to