8003444: Fix potential NULL pointer dereference
authorjchen
Fri, 17 May 2013 10:04:39 -0700
changeset 17671 bb08d5e5bd5e
parent 17408 bb1047aa94aa
child 17672 d1c8ac4c7a7b
8003444: Fix potential NULL pointer dereference Reviewed-by: jgodinez, prr
jdk/src/share/native/sun/java2d/cmm/lcms/cmscgats.c
jdk/src/share/native/sun/java2d/cmm/lcms/cmslut.c
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/cmscgats.c	Fri May 17 14:18:44 2013 +0400
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/cmscgats.c	Fri May 17 10:04:39 2013 -0700
@@ -634,6 +634,8 @@
     cmsFloat64Number dnum = 0.0;
     int sign = 1;
 
+    if (Buffer == NULL) return 0.0;
+
     if (*Buffer == '-' || *Buffer == '+') {
 
          sign = (*Buffer == '-') ? -1 : 1;
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Fri May 17 14:18:44 2013 +0400
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Fri May 17 10:04:39 2013 -0700
@@ -1021,6 +1021,8 @@
     mpe = cmsStageAllocToneCurves(ContextID, 3, LabTable);
     cmsFreeToneCurveTriple(LabTable);
 
+    if (mpe == NULL) return NULL;
+
     mpe ->Implements = cmsSigLabV2toV4;
     return mpe;
 }