8157759: LCMS Transform Sampling Enhancement
authorvadim
Tue, 28 Jun 2016 11:35:38 -0700
changeset 41567 10ed0e790b06
parent 41566 f52207d194bf
child 41568 eb6d80cff6c7
8157759: LCMS Transform Sampling Enhancement Reviewed-by: prr, serb, mschoene
jdk/src/java.desktop/share/native/liblcms/cmstypes.c
--- a/jdk/src/java.desktop/share/native/liblcms/cmstypes.c	Tue Jun 28 19:48:05 2016 +0300
+++ b/jdk/src/java.desktop/share/native/liblcms/cmstypes.c	Tue Jun 28 11:35:38 2016 -0700
@@ -4313,7 +4313,10 @@
 
     // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number
     nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : InputChans;
-    for (i=0; i < nMaxGrids; i++) GridPoints[i] = (cmsUInt32Number) Dimensions8[i];
+    for (i=0; i < nMaxGrids; i++) {
+        if (Dimensions8[i] == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least
+        GridPoints[i] = (cmsUInt32Number)Dimensions8[i];
+    }
 
     // Allocate the true CLUT
     mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputChans, OutputChans, NULL);