RESOLVED FIXED 200023
Fix crashes in ScrollingStateNode::insertChild()
https://bugs.webkit.org/show_bug.cgi?id=200023
Summary Fix crashes in ScrollingStateNode::insertChild()
Simon Fraser (smfr)
Reported 2019-07-22 18:40:26 PDT
Fix crashes in ScrollingStateNode::insertChild()
Attachments
Patch (1.75 KB, patch)
2019-07-22 18:41 PDT, Simon Fraser (smfr)
darin: review+
Simon Fraser (smfr)
Comment 1 2019-07-22 18:41:50 PDT
Simon Fraser (smfr)
Comment 2 2019-07-22 18:41:52 PDT
Darin Adler
Comment 3 2019-07-22 18:52:37 PDT
Comment on attachment 374662 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374662&action=review > Source/WebCore/ChangeLog:13 > + 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. Is there a reason we don’t do this inside the insert function instead? Are there other call sites where we want the stricter behavior? What about asserting the index is valid, even if we prevent the crash in such cases? That could help us some day understand how this happens if we reproduce in a build with assertions on.
Simon Fraser (smfr)
Comment 4 2019-07-23 12:50:46 PDT
Darin Adler
Comment 5 2019-07-23 19:12:46 PDT
Comment on attachment 374662 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374662&action=review > Source/WebCore/page/scrolling/ScrollingStateNode.cpp:119 > + if (index >= m_children->size()) The patch you landed uses ">" rather than ">=". Why is that?
Simon Fraser (smfr)
Comment 6 2019-07-23 19:42:54 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 374662 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=374662&action=review > > > Source/WebCore/page/scrolling/ScrollingStateNode.cpp:119 > > + if (index >= m_children->size()) > > The patch you landed uses ">" rather than ">=". Why is that? Because Vector::insert() allows inserting at index = size() - it has: ASSERT_WITH_SECURITY_IMPLICATION(position <= size());
Note You need to log in before you can comment on or make changes to this bug.