[gs-commits] mupdf 1.16.1.epub-prerelease-26 Bug 701840: Prefer lowest

[email protected] (Tor Andersson) Tue, 5 Nov 2019 15:49:45 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit bcecb8430d916fb8c509dfbea9fed5db393397a9
Author: Tor Andersson <[email protected]>
Date:   Tue Nov 5 15:22:44 2019 +0100

    Bug 701840: Prefer lowest N if ICC profile and PDF colorspace disagree.

diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index d49a5e9..cac5e43 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -12,6 +12,9 @@ load_icc_based(fz_context *ctx, pdf_obj *dict, int allow_alt)
 	fz_colorspace *cs = NULL;
 	pdf_obj *obj;
 
+	fz_var(alt);
+	fz_var(cs);
+
 	/* Look at Alternate to detect type (especially Lab). */
 	if (allow_alt)
 	{
@@ -36,8 +39,16 @@ load_icc_based(fz_context *ctx, pdf_obj *dict, int allow_alt)
 		{
 			buf = pdf_load_stream(ctx, dict);
 			cs = fz_new_icc_colorspace(ctx, alt ? alt->type : FZ_COLORSPACE_NONE, 0, NULL, buf);
-			if (cs->n != n)
-				fz_warn(ctx, "ICC colorspace N=%d does not match profile N=%d", n, cs->n);
+			if (cs->n > n)
+			{
+				fz_warn(ctx, "ICC colorspace N=%d does not match profile N=%d (ignoring profile)", n, cs->n);
+				fz_drop_colorspace(ctx, cs);
+				cs = NULL;
+			}
+			else if (cs->n < n)
+			{
+				fz_warn(ctx, "ICC colorspace N=%d does not match profile N=%d (using profile)", n, cs->n);
+			}
 		}
 		fz_always(ctx)
 			fz_drop_buffer(ctx, buf);

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=bcecb8430d916fb8c509dfbea9fed5db393397a9

--
MuPDF library
Artifex Software, Inc.