Title: [247858] branches/safari-608.1-branch/Source/WebCore
Revision
247858
Author
[email protected]
Date
2019-07-26 00:24:37 -0700 (Fri, 26 Jul 2019)

Log Message

Cherry-pick r247734. rdar://problem/53575398

    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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247734 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608.1-branch/Source/WebCore/ChangeLog (247857 => 247858)


--- branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-07-26 07:24:32 UTC (rev 247857)
+++ branches/safari-608.1-branch/Source/WebCore/ChangeLog	2019-07-26 07:24:37 UTC (rev 247858)
@@ -1,5 +1,43 @@
 2019-07-26  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r247734. rdar://problem/53575398
+
+    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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-26  Babak Shafiei  <[email protected]>
+
         Cherry-pick r247702. rdar://problem/53575418
 
     [iOS] [WK1] UIWebView always jumps to the top left corner when scrolling to reveal the selection

Modified: branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (247857 => 247858)


--- branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2019-07-26 07:24:32 UTC (rev 247857)
+++ branches/safari-608.1-branch/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2019-07-26 07:24:37 UTC (rev 247858)
@@ -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