From 53dfc60094f34bbbfd3410de9165396514fd23c2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 5 Jun 2019 21:47:15 +0100 Subject: Media queries: isn't allowed to have 0 numerator or denominator. The value type is a positive (not zero or negative) followed by optional whitespace, followed by a solidus ('/'), followed by optional whitespace, followed by a positive . s can be ordered or compared by transforming them into the number obtained by dividing their first by their second . -- https://www.w3.org/TR/mediaqueries-4/#aspect-ratio --- src/parse/mq.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- cgit v1.2.3