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.
This commit is contained in:
Pyfisch 2017-12-28 12:51:28 +01:00
parent d96fb89c31
commit 94f3e3353d
4 changed files with 42 additions and 0 deletions

View file

@ -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>