diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2009-05-02 02:49:48 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@hotmail.com> | 2009-05-02 02:49:48 +0200 |
commit | fb0ffe8f78671e131088dbec0888a4ae1b42c969 (patch) | |
tree | 3ae48e513dd541c4b9ee4c73ca08a0256a5f5dc4 | |
parent | 355af245325d7b0f354ff0d5b24e7de8d838b58d (diff) | |
download | mupdf-fb0ffe8f78671e131088dbec0888a4ae1b42c969.tar.xz |
Handle images that are missing bits per component.
-rw-r--r-- | mupdf/pdf_image.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c index 15a4757d..3f3fbc88 100644 --- a/mupdf/pdf_image.c +++ b/mupdf/pdf_image.c @@ -262,7 +262,7 @@ pdf_loadimage(pdf_image **imgp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) fz_dropobj(obj); } - bpc = 1; /* TODO: should check that ImageMask is true before using default */ + bpc = 0; obj = fz_dictgets(dict, "BitsPerComponent"); if (obj) { @@ -324,15 +324,20 @@ pdf_loadimage(pdf_image **imgp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) fz_dropcolorspace(cs); cs = nil; } - if (bpc != 1) + if (bpc != 0 && bpc != 1) fz_warn("masks can only have one component, proceeding anyway."); bpc = 1; n = 0; a = 1; } - else if (!cs) - return fz_throw("colorspace missing for image"); + else + { + if (!cs) + return fz_throw("colorspace missing for image"); + if (bpc == 0) + return fz_throw("image has not bits per component"); + } obj = fz_dictgets(dict, "SMask"); if (fz_isindirect(obj)) |