Title: [241881] branches/safari-607-branch/Source/WebCore
Revision
241881
Author
[email protected]
Date
2019-02-21 13:26:51 -0800 (Thu, 21 Feb 2019)

Log Message

Cherry-pick r241567. rdar://problem/48243396

    Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
    https://bugs.webkit.org/show_bug.cgi?id=194671
    <rdar://problem/47628191>

    Patch by Joseph Pecoraro <[email protected]> on 2019-02-14
    Reviewed by Devin Rousso.

    * css/CSSStyleSheet.cpp:
    (WebCore::CSSStyleSheet::item):
    A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
    sync with the m_contents list of rules. In particular if the wrappers
    vector is shorter than the rule list. We tried exercising code paths
    that modify these lists but were not able to reproduce the crash.
    To avoid a crash we can make this access safer and avoid the original
    overflow. At the same time we will keep and promote the assertion that
    would catch the lists getting out of sync in debug builds.

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

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241880 => 241881)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-21 21:26:49 UTC (rev 241880)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-21 21:26:51 UTC (rev 241881)
@@ -1,5 +1,46 @@
 2019-02-20  Alan Coon  <[email protected]>
 
+        Cherry-pick r241567. rdar://problem/48243396
+
+    Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
+    https://bugs.webkit.org/show_bug.cgi?id=194671
+    <rdar://problem/47628191>
+    
+    Patch by Joseph Pecoraro <[email protected]> on 2019-02-14
+    Reviewed by Devin Rousso.
+    
+    * css/CSSStyleSheet.cpp:
+    (WebCore::CSSStyleSheet::item):
+    A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
+    sync with the m_contents list of rules. In particular if the wrappers
+    vector is shorter than the rule list. We tried exercising code paths
+    that modify these lists but were not able to reproduce the crash.
+    To avoid a crash we can make this access safer and avoid the original
+    overflow. At the same time we will keep and promote the assertion that
+    would catch the lists getting out of sync in debug builds.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-14  Joseph Pecoraro  <[email protected]>
+
+            Web Inspector: Occasional crash under WebCore::CSSStyleSheet::item called from Inspector
+            https://bugs.webkit.org/show_bug.cgi?id=194671
+            <rdar://problem/47628191>
+
+            Reviewed by Devin Rousso.
+
+            * css/CSSStyleSheet.cpp:
+            (WebCore::CSSStyleSheet::item):
+            A crash may happen if the m_childRuleCSSOMWrappers Vector gets out of
+            sync with the m_contents list of rules. In particular if the wrappers
+            vector is shorter than the rule list. We tried exercising code paths
+            that modify these lists but were not able to reproduce the crash.
+            To avoid a crash we can make this access safer and avoid the original
+            overflow. At the same time we will keep and promote the assertion that
+            would catch the lists getting out of sync in debug builds.
+
+2019-02-20  Alan Coon  <[email protected]>
+
         Cherry-pick r241547. rdar://problem/48220627
 
     Web Inspector: don't include accessibility role in DOM.Node object payloads

Modified: branches/safari-607-branch/Source/WebCore/css/CSSStyleSheet.cpp (241880 => 241881)


--- branches/safari-607-branch/Source/WebCore/css/CSSStyleSheet.cpp	2019-02-21 21:26:49 UTC (rev 241880)
+++ branches/safari-607-branch/Source/WebCore/css/CSSStyleSheet.cpp	2019-02-21 21:26:51 UTC (rev 241881)
@@ -228,12 +228,12 @@
 {
     unsigned ruleCount = length();
     if (index >= ruleCount)
-        return 0;
+        return nullptr;
 
-    if (m_childRuleCSSOMWrappers.isEmpty())
+    ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == ruleCount);
+    if (m_childRuleCSSOMWrappers.size() < ruleCount)
         m_childRuleCSSOMWrappers.grow(ruleCount);
-    ASSERT(m_childRuleCSSOMWrappers.size() == ruleCount);
-    
+
     RefPtr<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index];
     if (!cssRule)
         cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to