summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2006-09-10 22:48:11 +0200
committerTor Andersson <tor@ghostscript.com>2006-09-10 22:48:11 +0200
commit85f1fa95644dabfd3aafe40bab93e9d9539e59cf (patch)
tree153232f50c8688704e01e4ef033d1bc83c856b41
parentb86ee9d2c921001b8bb1aceac45f601489abb1e7 (diff)
downloadmupdf-85f1fa95644dabfd3aafe40bab93e9d9539e59cf.tar.xz
fix for empty filters in inline streams
-rw-r--r--mupdf/pdf_image.c4
-rw-r--r--mupdf/pdf_stream.c8
-rw-r--r--stream/filt_null.c4
3 files changed, 12 insertions, 4 deletions
diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c
index c081d4f3..1d510ab9 100644
--- a/mupdf/pdf_image.c
+++ b/mupdf/pdf_image.c
@@ -131,6 +131,9 @@ pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref,
if (error)
return error;
+ if (filter == nil)
+ goto thereisnofilter;
+
error = fz_openrfilter(&tempfile, filter, file);
if (error)
return error;
@@ -144,6 +147,7 @@ pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref,
}
else
{
+thereisnofilter:
error = fz_newbuffer(&img->samples, img->super.h * img->stride);
if (error)
return error;
diff --git a/mupdf/pdf_stream.c b/mupdf/pdf_stream.c
index f7a18970..8717ed26 100644
--- a/mupdf/pdf_stream.c
+++ b/mupdf/pdf_stream.c
@@ -232,15 +232,17 @@ pdf_buildinlinefilter(fz_filter **filterp, fz_obj *stmobj)
filters = fz_dictgetsa(stmobj, "Filter", "F");
params = fz_dictgetsa(stmobj, "DecodeParms", "DP");
+ *filterp = nil;
+
if (filters)
{
if (fz_isname(filters))
return buildonefilter(filterp, filters, params);
- else
+ else if (fz_arraylen(filters) > 0)
return buildfilterchain(filterp, nil, filters, params);
}
- else
- return fz_newnullfilter(filterp, -1);
+
+ /* uh oh, no filter */
return nil;
}
diff --git a/stream/filt_null.c b/stream/filt_null.c
index d2c068e9..f51039b4 100644
--- a/stream/filt_null.c
+++ b/stream/filt_null.c
@@ -30,7 +30,9 @@ fz_processnullfilter(fz_filter *filter, fz_buffer *in, fz_buffer *out)
fz_nullfilter *f = (fz_nullfilter*)filter;
int n;
- n = MIN(MIN(in->wp - in->rp, out->ep - out->wp), f->len - f->cur);
+ n = MIN(in->wp - in->rp, out->ep - out->wp);
+ if (f->len >= 0)
+ n = MIN(n, f->len - f->cur);
if (n) {
memcpy(out->wp, in->rp, n);