From 26dde332a5810fa9d36bb94a12df15d974e327d2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 27 Sep 2010 10:55:51 +0000 Subject: Ignore garbage at the end of inline images and scan for the EI keyword without the lexer. --- mupdf/pdf_interpret.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mupdf/pdf_interpret.c b/mupdf/pdf_interpret.c index 03e18bcf..787bfddc 100644 --- a/mupdf/pdf_interpret.c +++ b/mupdf/pdf_interpret.c @@ -232,27 +232,23 @@ pdf_runinlineimage(pdf_csi *csi, fz_obj *rdb, fz_stream *file, fz_obj *dict) { fz_error error; fz_pixmap *img; - char buf[256]; - pdf_token_e tok; - int len; + int ch; error = pdf_loadinlineimage(&img, csi->xref, rdb, dict, file); if (error) return fz_rethrow(error, "cannot load inline image"); - error = pdf_lex(&tok, file, buf, sizeof buf, &len); - if (error) + /* find EI */ + ch = fz_readbyte(file); + while (ch != 'E' && ch != EOF) + ch = fz_readbyte(file); + ch = fz_readbyte(file); + if (ch != 'I') { fz_droppixmap(img); return fz_rethrow(error, "syntax error after inline image"); } - if (tok != PDF_TKEYWORD || strcmp("EI", buf)) - { - fz_droppixmap(img); - return fz_throw("syntax error after inline image"); - } - pdf_showimage(csi, img); fz_droppixmap(img); -- cgit v1.2.3