summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-09-23 18:08:04 +0100
committerRobin Watts <robin.watts@artifex.com>2013-09-24 12:02:33 +0100
commitac0a31f6fc71e07f67a43cd1fe5004def4c955a6 (patch)
treebb8c4c98885e624ec767354fce46acf01737faf9 /source/pdf
parent9f879e14e5645aff6b4be27271f2196c05f5a193 (diff)
downloadmupdf-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/pdf')
-rw-r--r--source/pdf/pdf-lex.c4
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 '[':