Title: [202658] trunk/Source/WebCore
Revision
202658
Author
[email protected]
Date
2016-06-29 16:28:16 -0700 (Wed, 29 Jun 2016)

Log Message

Fix null dereferencing after r201441
https://bugs.webkit.org/show_bug.cgi?id=159282
rdar://problem/27082559

Reviewed by Andreas Kling.

No new tests.  This is reproducible when dragging from regular to high-DPI displays, 
and we don't have testing infrastructure for simulating that.

* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::styleResolverChanged):
MediaQueryListListener::queryChanged can mutate the Vector of listeners while we are iterating it.
Copy the Vector of listeners and iterate the copy so we don't go out of bounds.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202657 => 202658)


--- trunk/Source/WebCore/ChangeLog	2016-06-29 23:05:55 UTC (rev 202657)
+++ trunk/Source/WebCore/ChangeLog	2016-06-29 23:28:16 UTC (rev 202658)
@@ -1,3 +1,19 @@
+2016-06-29  Alex Christensen  <[email protected]>
+
+        Fix null dereferencing after r201441
+        https://bugs.webkit.org/show_bug.cgi?id=159282
+        rdar://problem/27082559
+
+        Reviewed by Andreas Kling.
+
+        No new tests.  This is reproducible when dragging from regular to high-DPI displays, 
+        and we don't have testing infrastructure for simulating that.
+
+        * css/MediaQueryMatcher.cpp:
+        (WebCore::MediaQueryMatcher::styleResolverChanged):
+        MediaQueryListListener::queryChanged can mutate the Vector of listeners while we are iterating it.
+        Copy the Vector of listeners and iterate the copy so we don't go out of bounds.
+
 2016-06-29  Antti Koivisto  <[email protected]>
 
         Factor pending CSS resources into a struct

Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (202657 => 202658)


--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp	2016-06-29 23:05:55 UTC (rev 202657)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp	2016-06-29 23:28:16 UTC (rev 202658)
@@ -118,7 +118,11 @@
         return;
 
     MediaQueryEvaluator evaluator { mediaType(), *m_document, style.get() };
-    for (auto& listener : m_listeners) {
+    Vector<Listener> listeners;
+    listeners.reserveInitialCapacity(m_listeners.size());
+    for (auto& listener : m_listeners)
+        listeners.uncheckedAppend({ listener.listener.copyRef(), listener.query.copyRef() });
+    for (auto& listener : listeners) {
         bool notify;
         listener.query->evaluate(evaluator, notify);
         if (notify)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to