summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2009-05-03 21:04:37 +0200
committerSebastian Rasmussen <sebras@hotmail.com>2009-05-03 21:04:37 +0200
commitde7a3b8c8518ac542e178555939f782fc9004100 (patch)
tree92a49eef0ccd31bd91e641487dff937aa6bced2f
parentdbbe659c4c065bd453b2e33b81b5b5b65ba2ac38 (diff)
downloadmupdf-de7a3b8c8518ac542e178555939f782fc9004100.tar.xz
Handle pdfs with unexpected whitespace in xref.
-rw-r--r--mupdf/pdf_open.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mupdf/pdf_open.c b/mupdf/pdf_open.c
index 539244c4..d51e062b 100644
--- a/mupdf/pdf_open.c
+++ b/mupdf/pdf_open.c
@@ -170,6 +170,9 @@ readtrailer(pdf_xref *xref, char *buf, int cap)
if (error)
return fz_rethrow(error, "cannot seek to startxref");
+ while (iswhite(fz_peekbyte(xref->file)))
+ fz_readbyte(xref->file);
+
c = fz_peekbyte(xref->file);
error = fz_readerror(xref->file);
if (error)
@@ -451,6 +454,9 @@ readxref(fz_obj **trailerp, pdf_xref *xref, int ofs, char *buf, int cap)
if (error)
return fz_rethrow(error, "cannot seek to xref");
+ while (iswhite(fz_peekbyte(xref->file)))
+ fz_readbyte(xref->file);
+
c = fz_peekbyte(xref->file);
error = fz_readerror(xref->file);
if (error)