diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2019-06-05 21:47:15 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2019-06-05 21:47:15 +0100 |
commit | 53dfc60094f34bbbfd3410de9165396514fd23c2 (patch) | |
tree | e3721caccde987ff4742fe87acbd3b80324a4c8a | |
parent | 298dd8dd93abfc33c3ab3209f00d78e93fbd041c (diff) | |
download | libcss-53dfc60094f34bbbfd3410de9165396514fd23c2.tar.gz libcss-53dfc60094f34bbbfd3410de9165396514fd23c2.tar.bz2 |
Media queries: <ratio> isn't allowed to have 0 numerator or denominator.
The <ratio> value type is a positive (not zero or negative) <integer>
followed by optional whitespace, followed by a solidus ('/'), followed
by optional whitespace, followed by a positive <integer>. <ratio>s can
be ordered or compared by transforming them into the number obtained
by dividing their first <integer> by their second <integer>.
-- https://www.w3.org/TR/mediaqueries-4/#aspect-ratio
-rw-r--r-- | src/parse/mq.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/parse/mq.c b/src/parse/mq.c index f3510c1..c5e353d 100644 --- a/src/parse/mq.c +++ b/src/parse/mq.c @@ -117,6 +117,10 @@ static css_error mq_parse_ratio( num = css__number_from_lwc_string(numerator->idata, true, &num_len); den = css__number_from_lwc_string(token->idata, true, &den_len); + if (num == 0 || den == 0) { + return CSS_INVALID; + } + *ratio = css_divide_fixed(num, den); return CSS_OK; |