< prev index next >

src/java.desktop/share/native/liblcms/cmslut.c

Print this page
@@ -502,10 +502,13 @@
  
          // Check for overflow
          if (rv > UINT_MAX / dim) return 0;
      }
  
+     // Again, prevent overflow
+     if (rv > UINT_MAX / 15) return 0;
+ 
      return rv;
  }
  
  static
  void* CLUTElemDup(cmsStage* mpe)

@@ -841,11 +844,17 @@
      int i, t, index, rest;
      cmsUInt32Number nTotalPoints;
      cmsUInt32Number nInputs, nOutputs;
      cmsUInt32Number* nSamples;
      cmsFloat32Number In[MAX_INPUT_DIMENSIONS+1], Out[MAX_STAGE_CHANNELS];
-     _cmsStageCLutData* clut = (_cmsStageCLutData*) mpe->Data;
+     _cmsStageCLutData* clut;
+ 
+     if (mpe == NULL) return FALSE;
+ 
+     clut = (_cmsStageCLutData*)mpe->Data;
+ 
+     if (clut == NULL) return FALSE;
  
      nSamples = clut->Params ->nSamples;
      nInputs  = clut->Params ->nInputs;
      nOutputs = clut->Params ->nOutputs;
  
< prev index next >