Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@Property] Nullptr crash with calc()
https://bugs.webkit.org/show_bug.cgi?id=256032 rdar://105491386 Reviewed by Alan Baradlay. * LayoutTests/fast/css/custom-properties/at-property-calc-crash.html: Added. * LayoutTests/fast/css/custom-properties/at-property-calc-crash-expected.txt: Added. * Source/WebCore/css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::customCSSText const): Ensure that we don't crash even if the calc expression building returns null. * Source/WebCore/css/calc/CSSCalcValue.cpp: (WebCore::createCSS): Limit zero-length elimination when constructing CSSCalcExpressionNodes from CalcExpressionNodes to sum and substract expressions. With other expression types eliminating zeroes can lead to miscomputing the expression unit category and the building code returning null. Canonical link: https://commits.webkit.org/263453@main
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
LayoutTests/fast/css/custom-properties/at-property-calc-crash-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This test passes it it doesn't crash. |
16 changes: 16 additions & 0 deletions
16
LayoutTests/fast/css/custom-properties/at-property-calc-crash.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<style> | ||
body { | ||
--v: calc(0% + 1px + 0 * max(0px, 0cqi)); | ||
width: var(--v); | ||
} | ||
@property --v { | ||
syntax: '<length-percentage>'; | ||
inherits: false; | ||
initial-value: 0; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
</script> | ||
This test passes it it doesn't crash. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters