--- old/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c 2015-04-29 14:38:42.176144222 -0700 +++ new/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c 2015-04-29 14:38:42.036144218 -0700 @@ -712,15 +712,21 @@ // Internal: get the memory area associanted with each context client -// Returns the block assigned to the specific zone. +// Returns the block assigned to the specific zone. Never return NULL. void* _cmsContextGetClientChunk(cmsContext ContextID, _cmsMemoryClient mc) { struct _cmsContext_struct* ctx; void *ptr; - if (mc < 0 || mc >= MemoryClientMax) { - cmsSignalError(ContextID, cmsERROR_RANGE, "Bad context client"); - return NULL; + if ((int) mc < 0 || mc >= MemoryClientMax) { + + cmsSignalError(ContextID, cmsERROR_INTERNAL, "Bad context client -- possible corruption"); + + // This is catastrophic. Should never reach here + _cmsAssert(0); + + // Reverts to global context + return globalContext.chunks[UserPtr]; } ctx = _cmsGetContext(ContextID); @@ -909,7 +915,7 @@ } - +/* static struct _cmsContext_struct* FindPrev(struct _cmsContext_struct* id) { @@ -926,6 +932,7 @@ return NULL; // List is empty or only one element! } +*/ // Frees any resources associated with the given context, // and destroys the context placeholder. @@ -961,8 +968,8 @@ // Search for previous for (prev = _cmsContextPoolHead; - prev != NULL; - prev = prev ->Next) + prev != NULL; + prev = prev ->Next) { if (prev -> Next == ctx) { prev -> Next = ctx ->Next;