diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-07-22 10:58:37 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-07-22 10:58:37 +0000 |
commit | 2aa7afdf0bba060226ada5d78582b09ae3a8c510 (patch) | |
tree | 80ec0aa2822f903dfe89349b00e7fe6ea3a3484b | |
parent | 5073104a68ca52a8b0e875fc4c5dbacaff98f073 (diff) | |
download | mupdf-2aa7afdf0bba060226ada5d78582b09ae3a8c510.tar.xz |
Fix bug where inline image data was not being fully loaded.
-rw-r--r-- | mupdf/mupdf.h | 2 | ||||
-rw-r--r-- | mupdf/pdf_image.c | 12 | ||||
-rw-r--r-- | mupdf/pdf_stream.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h index 8aeb574c..25f01b8e 100644 --- a/mupdf/mupdf.h +++ b/mupdf/mupdf.h @@ -152,7 +152,7 @@ fz_error pdf_cacheobject(pdf_xref *, int num, int gen); fz_error pdf_loadobject(fz_obj **objp, pdf_xref *, int num, int gen); int pdf_isstream(pdf_xref *xref, int num, int gen); -fz_filter * pdf_buildinlinefilter(pdf_xref *xref, fz_obj *stmobj); +fz_filter * pdf_buildinlinefilter(pdf_xref *xref, fz_obj *stmobj, int length); fz_error pdf_loadrawstream(fz_buffer **bufp, pdf_xref *xref, int num, int gen); fz_error pdf_loadstream(fz_buffer **bufp, pdf_xref *xref, int num, int gen); fz_error pdf_openrawstream(fz_stream **stmp, pdf_xref *, int num, int gen); diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c index 8950a338..f0bddb70 100644 --- a/mupdf/pdf_image.c +++ b/mupdf/pdf_image.c @@ -108,7 +108,7 @@ pdf_loadimageheader(pdf_image **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict) /* Not allowed for inline images */ obj = fz_dictgetsa(dict, "SMask", "Mask"); - if (pdf_isstream(xref, fz_tonum(obj), fz_togen(obj))) + if (fz_isdict(obj)) { error = pdf_loadimage(&img->mask, xref, rdb, obj); if (error) @@ -169,11 +169,11 @@ pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, if (error) return fz_rethrow(error, "cannot load inline image"); - filter = pdf_buildinlinefilter(xref, dict); + filter = pdf_buildinlinefilter(xref, dict, img->stride * img->h); subfile = fz_openfilter(filter, file); img->samples = fz_newbuffer(img->h * img->stride); - error = fz_read(&n, file, img->samples->bp, img->h * img->stride); + error = fz_read(&n, subfile, img->samples->bp, img->h * img->stride); if (error) { pdf_dropimage(img); @@ -181,6 +181,9 @@ pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, } img->samples->wp += n; + fz_dropstream(subfile); + fz_dropfilter(filter); + if (img->imagemask) { /* 0=opaque and 1=transparent so we need to invert */ @@ -189,9 +192,6 @@ pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, *p = ~*p; } - fz_dropstream(subfile); - fz_dropfilter(filter); - pdf_logimage("}\n"); *imgp = img; diff --git a/mupdf/pdf_stream.c b/mupdf/pdf_stream.c index 692c022d..6d8fef95 100644 --- a/mupdf/pdf_stream.c +++ b/mupdf/pdf_stream.c @@ -249,7 +249,7 @@ buildrawfilter(pdf_xref *xref, fz_obj *stmobj, int num, int gen) * constraining to stream length, and without decryption. */ fz_filter * -pdf_buildinlinefilter(pdf_xref *xref, fz_obj *stmobj) +pdf_buildinlinefilter(pdf_xref *xref, fz_obj *stmobj, int length) { fz_obj *filters; fz_obj *params; @@ -264,7 +264,7 @@ pdf_buildinlinefilter(pdf_xref *xref, fz_obj *stmobj) return buildfilterchain(xref, nil, filters, params, 0, 0); } - return fz_newcopyfilter(); + return fz_newnullfilter(length); } /* |