Title: [271451] trunk
Revision
271451
Author
[email protected]
Date
2021-01-13 13:04:12 -0800 (Wed, 13 Jan 2021)

Log Message

Null check selector.argumentList()
https://bugs.webkit.org/show_bug.cgi?id=220392

Patch by Rob Buis <[email protected]> on 2021-01-13
Reviewed by Wenson Hsieh.

Source/WebCore:

Null check selector.argumentList().

Test: highlight/highlight-crash.html

* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):

LayoutTests:

Add test that triggers the relevant code path.

* highlight/highlight-crash-expected.txt: Added.
* highlight/highlight-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (271450 => 271451)


--- trunk/LayoutTests/ChangeLog	2021-01-13 20:21:35 UTC (rev 271450)
+++ trunk/LayoutTests/ChangeLog	2021-01-13 21:04:12 UTC (rev 271451)
@@ -1,3 +1,15 @@
+2021-01-13  Rob Buis  <[email protected]>
+
+        Null check selector.argumentList()
+        https://bugs.webkit.org/show_bug.cgi?id=220392
+
+        Reviewed by Wenson Hsieh.
+
+        Add test that triggers the relevant code path.
+
+        * highlight/highlight-crash-expected.txt: Added.
+        * highlight/highlight-crash.html: Added.
+
 2021-01-13  Antti Koivisto  <[email protected]>
 
         REGRESSION (r257839): Broken focus when 'display' changes in an attribute selector

Added: trunk/LayoutTests/highlight/highlight-crash-expected.txt (0 => 271451)


--- trunk/LayoutTests/highlight/highlight-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/highlight/highlight-crash-expected.txt	2021-01-13 21:04:12 UTC (rev 271451)
@@ -0,0 +1 @@
+This test should not crash.

Added: trunk/LayoutTests/highlight/highlight-crash.html (0 => 271451)


--- trunk/LayoutTests/highlight/highlight-crash.html	                        (rev 0)
+++ trunk/LayoutTests/highlight/highlight-crash.html	2021-01-13 21:04:12 UTC (rev 271451)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ HighlightAPIEnabled=true ] -->
+<style>
+::highlight { background: red }
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<p>This test should not crash.</p>

Modified: trunk/Source/WebCore/ChangeLog (271450 => 271451)


--- trunk/Source/WebCore/ChangeLog	2021-01-13 20:21:35 UTC (rev 271450)
+++ trunk/Source/WebCore/ChangeLog	2021-01-13 21:04:12 UTC (rev 271451)
@@ -1,3 +1,17 @@
+2021-01-13  Rob Buis  <[email protected]>
+
+        Null check selector.argumentList()
+        https://bugs.webkit.org/show_bug.cgi?id=220392
+
+        Reviewed by Wenson Hsieh.
+
+        Null check selector.argumentList().
+
+        Test: highlight/highlight-crash.html
+
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne const):
+
 2021-01-13  Ziran Sun  <[email protected]>
 
         [css-logical] Implement logical border-radius

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (271450 => 271451)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2021-01-13 20:21:35 UTC (rev 271450)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2021-01-13 21:04:12 UTC (rev 271451)
@@ -1143,7 +1143,7 @@
             // Always matches when not specifically requested so it gets added to the pseudoIdSet.
             if (checkingContext.pseudoId == PseudoId::None)
                 return true;
-            if (checkingContext.pseudoId != PseudoId::Highlight)
+            if (checkingContext.pseudoId != PseudoId::Highlight || !selector.argumentList())
                 return false;
             return selector.argumentList()->first() == checkingContext.nameForHightlightPseudoElement;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to