summaryrefslogtreecommitdiff
path: root/source/html/css-apply.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-10-12 12:26:30 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-10-12 14:45:42 +0200
commitcf94c2a1e8cac52074183b31f75b71480dbdcea1 (patch)
treebe85730dc6f39902f6081ef74e96e1747a9cfc40 /source/html/css-apply.c
parentca8f55472a46cf0b2007d15f26d9f0eddb2ce7df (diff)
downloadmupdf-cf94c2a1e8cac52074183b31f75b71480dbdcea1.tar.xz
Bug 696958: parse css hex colors that are missing the '#' prefix.
Diffstat (limited to 'source/html/css-apply.c')
-rw-r--r--source/html/css-apply.c6
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;
}