From 1d52e081bc36edef3f8503fae18db0291b186c68 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 28 Jul 2018 14:35:00 +0100 Subject: Parsing: Fix undefined shift in css__parse_hash_colour. uint a = 0xff; a << 24 `a` gets promoted to int, which can't store the value. src/parse/properties/utils.c:655:16: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' src/parse/properties/utils.c:889:15: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' --- src/parse/properties/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 76b406b..7abef24 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -652,7 +652,7 @@ css_error css__parse_colour_specifier(css_language *c, goto invalid; } - *result = (a << 24) | (r << 16) | (g << 8) | b; + *result = ((unsigned)a << 24) | (r << 16) | (g << 8) | b; } *value = COLOR_SET; @@ -886,7 +886,7 @@ css_error css__parse_hash_colour(lwc_string *data, uint32_t *result) } else return CSS_INVALID; - *result = (a << 24) | (r << 16) | (g << 8) | b; + *result = ((unsigned)a << 24) | (r << 16) | (g << 8) | b; return CSS_OK; } -- cgit v1.2.3