aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2017-01-31 22:23:00 -0800
committerManish Goregaokar <manishsmail@gmail.com>2017-01-31 22:23:00 -0800
commitc0e1a1f9631276b807f302637f096af42575ca28 (patch)
tree0547a02678b6d9af3804eeedbe2546e8f5cc8689
parentda89099e26955cf5ba44031a0a536e3af4e6a0d5 (diff)
downloadservo-c0e1a1f9631276b807f302637f096af42575ca28.tar.gz
servo-c0e1a1f9631276b807f302637f096af42575ca28.zip
Ensure that gradients have at least 2 stops
-rw-r--r--components/style/values/specified/image.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs
index 3709ad20619..f63c1ae0ec3 100644
--- a/components/style/values/specified/image.rs
+++ b/components/style/values/specified/image.rs
@@ -141,6 +141,11 @@ impl Gradient {
_ => { return Err(()); }
};
+ // https://drafts.csswg.org/css-images/#typedef-color-stop-list
+ if stops.len() < 2 {
+ return Err(())
+ }
+
Ok(Gradient {
stops: stops,
repeating: repeating,