[gs-commits] mupdf/master - 0_6-213-gcb53cf1 - Fix bug where inline image data was not being fully loaded.

Tor Andersson tor at ghostscript.com
Thu Jul 22 11:00:47 UTC 2010


commit cb53cf1f2da6b57c785f0529aace7bcf1722e7ad
Author: Tor Andersson <tor at ghostscript.com>
Date:   Thu Jul 22 10:58:37 2010 +0000

    Fix bug where inline image data was not being fully loaded.
    
    Ignore-this: 129a41b85ed3fe9964fa59541362cc3a
    
    darcs-hash:20100722105837-f546f-5d5bc014163f78b6146bf6b8714d5d214f7ca55c.gz

 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/mupdf/mupdf.h b/mupdf/mupdf.h
index 8aeb574..25f01b8 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 8950a33..f0bddb7 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 692c022..6d8fef9 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);
 }
 
 /*

--
git/hooks/post-receive


More information about the gs-commits mailing list