From ac0a31f6fc71e07f67a43cd1fe5004def4c955a6 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 23 Sep 2013 18:08:04 +0100 Subject: 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. --- source/pdf/pdf-lex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') 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 '[': -- cgit v1.2.3