7051394: NullPointerException when running regression tests LoadProfileTest by using openjdk-7-b144

Reviewed-by: jgodinez, prr
This commit is contained in:
Andrew Brygin 2012-10-23 13:10:52 +04:00
parent 1c78bebc35
commit 433715e09c

View File

@ -253,6 +253,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_loadProfile
if (sProf.pf == NULL) {
JNU_ThrowIllegalArgumentException(env, "Invalid profile data");
} else {
/* Sanity check: try to save the profile in order
* to force basic validation.
*/
cmsUInt32Number pfSize = 0;
if (!cmsSaveProfileToMem(sProf.pf, NULL, &pfSize) ||
pfSize < sizeof(cmsICCHeader))
{
JNU_ThrowIllegalArgumentException(env, "Invalid profile data");
}
}
return sProf.j;