summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2018-07-28 14:35:00 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2018-07-28 14:39:05 +0100
commit1d52e081bc36edef3f8503fae18db0291b186c68 (patch)
treecc3faa5118ab26ac4a1256ae096e304442a123da /src
parenta0fcc8e5dee6f61c12ce44503edd26e699d5e663 (diff)
downloadlibcss-1d52e081bc36edef3f8503fae18db0291b186c68.tar.gz
libcss-1d52e081bc36edef3f8503fae18db0291b186c68.tar.bz2
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'
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/utils.c4
1 files 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;
}