[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1929-g7043e98

[email protected] (Michael Vrhel) Thu, 21 Nov 2019 20:09:13 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  7043e985298f75291e1fc25ad272140be31ffe6d (commit)
      from  aa30c0798d32decfd99ff8149553221917d4301e (commit)

----------------------------------------------------------------------
commit 7043e985298f75291e1fc25ad272140be31ffe6d
Author: Michael Vrhel <[email protected]>
Date:   Thu Nov 21 11:20:49 2019 -0800

    Ghostscript Bug 701324.  Improved robustness of lcms2mt
    
    lcmsmt will give up if it can't find the perceptual MLUT.
    This fix will have it check to see if the colorimetric or
    saturation intents are present also.

diff --git a/lcms2mt/src/cmsio1.c b/lcms2mt/src/cmsio1.c
index f95a19b..627f859 100644
--- a/lcms2mt/src/cmsio1.c
+++ b/lcms2mt/src/cmsio1.c
@@ -308,6 +308,7 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi
     cmsTagTypeSignature OriginalType;
     cmsTagSignature tag16;
     cmsTagSignature tagFloat;
+    int k;
 
     // On named color, take the appropriate tag
     if (cmsGetDeviceClass(ContextID, hProfile) == cmsSigNamedColorClass) {
@@ -345,9 +346,17 @@ cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsContext ContextID, cmsHPROFILE hProfi
             return _cmsReadFloatInputTag(ContextID, hProfile, tagFloat);
         }
 
-        // Revert to perceptual if no tag is found
+        /* There are profiles out there (not legal) that may only have a
+           colorimetric or saturation tag and no perceptual tag.  If we
+           can't find the specified intent be a bit robust and not give
+           up until we can't find any table, starting with perceptual */
         if (!cmsIsTag(ContextID, hProfile, tag16)) {
-            tag16 = Device2PCS16[0];
+            for (k = 0; k < 3; k++) {
+                if (cmsIsTag(ContextID, hProfile, Device2PCS16[k])) {
+                    tag16 = Device2PCS16[k];
+                    break;
+                }
+            }
         }
 
         if (cmsIsTag(ContextID, hProfile, tag16)) { // Is there any LUT-Based table?


Summary of changes:
 lcms2mt/src/cmsio1.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)