< prev index next >
src/share/native/sun/java2d/cmm/lcms/cmsnamed.c
Print this page
rev 12531 : 8171261: Stability fixes for lcms
Reviewed-by: serb, vadim, mschoene
*** 519,529 ****
size = 64; // Initial guess
else
size = v ->Allocated * 2;
// Keep a maximum color lists can grow, 100K entries seems reasonable
! if (size > 1024*100) return FALSE;
NewPtr = (_cmsNAMEDCOLOR*) _cmsRealloc(v ->ContextID, v ->List, size * sizeof(_cmsNAMEDCOLOR));
if (NewPtr == NULL)
return FALSE;
--- 519,533 ----
size = 64; // Initial guess
else
size = v ->Allocated * 2;
// Keep a maximum color lists can grow, 100K entries seems reasonable
! if (size > 1024 * 100) {
! _cmsFree(v->ContextID, (void*) v->List);
! v->List = NULL;
! return FALSE;
! }
NewPtr = (_cmsNAMEDCOLOR*) _cmsRealloc(v ->ContextID, v ->List, size * sizeof(_cmsNAMEDCOLOR));
if (NewPtr == NULL)
return FALSE;
*** 541,552 ****
v ->List = NULL;
v ->nColors = 0;
v ->ContextID = ContextID;
! while (v -> Allocated < n){
! if (!GrowNamedColorList(v)) return NULL;
}
strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);
strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix)-1);
v->Prefix[32] = v->Suffix[32] = 0;
--- 545,559 ----
v ->List = NULL;
v ->nColors = 0;
v ->ContextID = ContextID;
! while (v -> Allocated < n) {
! if (!GrowNamedColorList(v)) {
! _cmsFree(ContextID, (void*) v);
! return NULL;
! }
}
strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1);
strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix)-1);
v->Prefix[32] = v->Suffix[32] = 0;
< prev index next >