Title: [272295] trunk/Source/WebCore
Revision
272295
Author
[email protected]
Date
2021-02-02 21:10:24 -0800 (Tue, 02 Feb 2021)

Log Message

REGRESSION (r271439): null-dereference in useSmoothScrolling
https://bugs.webkit.org/show_bug.cgi?id=221302

Reviewed by Simon Fraser.

* page/ScrollBehavior.cpp:
(WebCore::useSmoothScrolling): Move the null check before any dereferencing
of the element pointer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272294 => 272295)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 04:00:09 UTC (rev 272294)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 05:10:24 UTC (rev 272295)
@@ -1,3 +1,14 @@
+2021-02-02  Darin Adler  <[email protected]>
+
+        REGRESSION (r271439): null-dereference in useSmoothScrolling
+        https://bugs.webkit.org/show_bug.cgi?id=221302
+
+        Reviewed by Simon Fraser.
+
+        * page/ScrollBehavior.cpp:
+        (WebCore::useSmoothScrolling): Move the null check before any dereferencing
+        of the element pointer.
+
 2021-02-02  Alex Christensen  <[email protected]>
 
         Add stub in ContentExtensionsBackend for HTTPS upgrade

Modified: trunk/Source/WebCore/page/ScrollBehavior.cpp (272294 => 272295)


--- trunk/Source/WebCore/page/ScrollBehavior.cpp	2021-02-03 04:00:09 UTC (rev 272294)
+++ trunk/Source/WebCore/page/ScrollBehavior.cpp	2021-02-03 05:10:24 UTC (rev 272295)
@@ -35,14 +35,15 @@
 
 bool useSmoothScrolling(ScrollBehavior behavior, Element* associatedElement)
 {
+    if (!associatedElement)
+        return false;
+
     // FIXME: Should we use document()->scrollingElement()?
     // See https://bugs.webkit.org/show_bug.cgi?id=205059
     if (associatedElement == associatedElement->document().scrollingElement())
         associatedElement = associatedElement->document().documentElement();
 
-    if (!associatedElement
-        || !associatedElement->renderer()
-        || !associatedElement->document().settings().CSSOMViewSmoothScrollingEnabled())
+    if (!associatedElement->renderer() || !associatedElement->document().settings().CSSOMViewSmoothScrollingEnabled())
         return false;
 
     // https://drafts.csswg.org/cssom-view/#scrolling
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to