diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-10-12 12:26:30 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-10-12 14:45:42 +0200 |
commit | cf94c2a1e8cac52074183b31f75b71480dbdcea1 (patch) | |
tree | be85730dc6f39902f6081ef74e96e1747a9cfc40 | |
parent | ca8f55472a46cf0b2007d15f26d9f0eddb2ce7df (diff) | |
download | mupdf-cf94c2a1e8cac52074183b31f75b71480dbdcea1.tar.xz |
Bug 696958: parse css hex colors that are missing the '#' prefix.
-rw-r--r-- | source/html/css-apply.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 43aaa905..d7375752 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -1022,7 +1022,9 @@ color_from_value(fz_css_value *value, fz_css_color initial) if (value->type == CSS_HASH) { int r, g, b; - size_t n = strlen(value->data); + size_t n; +hex_color: + n = strlen(value->data); if (n == 3) { r = tohex(value->data[0]) * 16 + tohex(value->data[0]); @@ -1093,7 +1095,7 @@ color_from_value(fz_css_value *value, fz_css_color initial) return make_color(0xC0, 0xC0, 0xC0, 255); if (!strcmp(value->data, "gray")) return make_color(0x80, 0x80, 0x80, 255); - return make_color(0, 0, 0, 255); + goto hex_color; /* last ditch attempt: maybe it's a #XXXXXX color without the # */ } return initial; } |