Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix division by zero in gradient stop calculation
Check if total_length is zero and return 0.0 instead of NaN in this case. Closes #18435 Regression test for crash.
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
tests/wpt/web-platform-tests/css/css-images/gradient-crash-ref.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 @@ | ||
<!--intentionally blank--> |
12 changes: 12 additions & 0 deletions
12
tests/wpt/web-platform-tests/css/css-images/gradient-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,12 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Does this gradient crash the browser?</title> | ||
<link rel="match" href="gradient-crash-ref.html"> | ||
<link rel="help" href="https://drafts.csswg.org/css-images-3/#color-stop-syntax"> | ||
<meta name="assert" content="Gradients with total length zero and absolute positioned stops do not crash."> | ||
<style> | ||
div { | ||
background: linear-gradient(black 0,white); | ||
} | ||
</style> | ||
<div></div> |