summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-lex.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-08-09 11:30:12 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-08-10 14:09:46 +0200
commitea8e910bb8f0d974673fcf32b89303da0b13c942 (patch)
tree49fed6cf0f5be00bd754826a5e9d602890972e5d /source/pdf/pdf-lex.c
parent61b9c24763ec367ba788937fc309d710120db5fd (diff)
downloadmupdf-ea8e910bb8f0d974673fcf32b89303da0b13c942.tar.xz
Treat invalid and truncated hex string characters as '0'.
Diffstat (limited to 'source/pdf/pdf-lex.c')
-rw-r--r--source/pdf/pdf-lex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/pdf/pdf-lex.c b/source/pdf/pdf-lex.c
index bc7393c7..e6a925ff 100644
--- a/source/pdf/pdf-lex.c
+++ b/source/pdf/pdf-lex.c
@@ -419,6 +419,9 @@ lex_hex_string(fz_context *ctx, fz_stream *f, pdf_lexbuf *lb)
{
case IS_WHITE:
break;
+ default:
+ fz_warn(ctx, "invalid character in hex string");
+ /* fall through */
case IS_HEX:
if (x)
{
@@ -432,11 +435,13 @@ lex_hex_string(fz_context *ctx, fz_stream *f, pdf_lexbuf *lb)
}
break;
case '>':
+ if (x)
+ {
+ *s++ = a * 16; /* pad truncated string with '0' */
+ }
goto end;
case EOF:
return PDF_TOK_ERROR;
- default:
- fz_warn(ctx, "ignoring invalid character in hex string");
}
}
end: