diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-09-23 18:08:04 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-09-24 12:02:33 +0100 |
commit | ac0a31f6fc71e07f67a43cd1fe5004def4c955a6 (patch) | |
tree | bb8c4c98885e624ec767354fce46acf01737faf9 /source | |
parent | 9f879e14e5645aff6b4be27271f2196c05f5a193 (diff) | |
download | mupdf-ac0a31f6fc71e07f67a43cd1fe5004def4c955a6.tar.xz |
Bug 694557: Fix infinite loop in pdf_lex.
When we read a '>' during lexing, we try to read another char to see
if it's another '>'. If not, we warn that it's unexpected, put the char
back and retry.
Putting the char back fails if the '>' was the last char in the stream
as we will then have read EOF. We then loop and reread the '>' resulting
in an infinite loop. Simple fix is to check for EOF.
Diffstat (limited to 'source')
-rw-r--r-- | source/pdf/pdf-lex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/pdf/pdf-lex.c b/source/pdf/pdf-lex.c index a8bf9f4b..1be369eb 100644 --- a/source/pdf/pdf-lex.c +++ b/source/pdf/pdf-lex.c @@ -483,6 +483,10 @@ pdf_lex(fz_stream *f, pdf_lexbuf *buf) return PDF_TOK_CLOSE_DICT; } fz_warn(f->ctx, "lexical error (unexpected '>')"); + if (c == EOF) + { + return PDF_TOK_EOF; + } fz_unread_byte(f); continue; case '[': |