summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-02-25 11:31:33 -0800
committerRobin Watts <robin.watts@artifex.com>2012-02-25 11:31:33 -0800
commitc8dc1547226920f64f14d6aa4ad5d40563dc6845 (patch)
treed2c2df833383be734d0b4303defb7ca75df2895b /pdf
parent9ef2a68e77842456ab30594a9a8d2c0535314715 (diff)
downloadmupdf-c8dc1547226920f64f14d6aa4ad5d40563dc6845.tar.xz
Fix assert/SEGVs seen in cluster due to using a color image as a mask.
When loading a JPX image with no specified colorspace, we were ending with image->colorspace being set to NULL. This caused us to treat the image as a mask. The correct fix is to inherit the colorspace from the jpx once loaded.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_image.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index 9626d6f0..22cca81d 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -505,6 +505,9 @@ pdf_load_jpx(pdf_document *xref, fz_obj *dict, pdf_image *image)
img = fz_load_jpx(ctx, buf->data, buf->len, colorspace);
/* RJW: "cannot load jpx image" */
+ if (img && colorspace == NULL)
+ colorspace = fz_keep_colorspace(ctx, img->colorspace);
+
fz_drop_buffer(ctx, buf);
buf = NULL;