Commit 86872644 by Aaron Leung

Adding bounds checking for hsla.

parent 08ca7622
...@@ -250,10 +250,17 @@ namespace Sass { ...@@ -250,10 +250,17 @@ namespace Sass {
bindings[parameter_names[3].token()].is_numeric())) { bindings[parameter_names[3].token()].is_numeric())) {
throw_eval_error("arguments to hsla must be numeric", bindings[parameter_names[0].token()].path(), bindings[parameter_names[0].token()].line()); throw_eval_error("arguments to hsla must be numeric", bindings[parameter_names[0].token()].path(), bindings[parameter_names[0].token()].line());
} }
double h = bindings[parameter_names[0].token()].numeric_value(); Node hn(bindings[parameter_names[0].token()]);
double s = bindings[parameter_names[1].token()].numeric_value(); Node sn(bindings[parameter_names[1].token()]);
double l = bindings[parameter_names[2].token()].numeric_value(); Node ln(bindings[parameter_names[2].token()]);
double a = bindings[parameter_names[3].token()].numeric_value(); Node an(bindings[parameter_names[3].token()]);
double h = hn.numeric_value();
double s = sn.numeric_value();
double l = ln.numeric_value();
double a = an.numeric_value();
if (s < 0 || 100 < s) throw_eval_error("saturation must be between 0% and 100% for 'hsla'", sn.path(), sn.line());
if (l < 0 || 100 < l) throw_eval_error("lightness must be between 0% and 100% for 'hsla'", ln.path(), ln.line());
if (a < 0 || 1 < a) throw_eval_error("alpha must be between 0 and 1 for 'hsla'", an.path(), an.line());
Node color(hsla_impl(h, s, l, a, new_Node)); Node color(hsla_impl(h, s, l, a, new_Node));
return color; return color;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment