diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-09-27 10:55:51 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-09-27 10:55:51 +0000 |
commit | 26dde332a5810fa9d36bb94a12df15d974e327d2 (patch) | |
tree | 82474fb5675412bcac4fa1138f9896174953f99c | |
parent | 34d36dfeb3177b6a0a33d4302638bcee3afdb754 (diff) | |
download | mupdf-26dde332a5810fa9d36bb94a12df15d974e327d2.tar.xz |
Ignore garbage at the end of inline images and scan for the EI keyword without the lexer.
-rw-r--r-- | mupdf/pdf_interpret.c | 18 |
1 files 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); |