diff --git a/src/cmsps2.c b/src/cmsps2.c index 2ffb8aca..afd14048 100644 --- a/src/cmsps2.c +++ b/src/cmsps2.c @@ -1314,12 +1314,17 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent DeviceLink = cmsPipelineDup(v ->Lut); if (DeviceLink == NULL) { cmsDeleteTransform(xform); + cmsSignalError(m->ContextID, cmsERROR_CORRUPTION_DETECTED, "Cannot access link for CRD"); return 0; } // We need a CLUT dwFlags |= cmsFLAGS_FORCE_CLUT; - _cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags); + if (!_cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags)) { + cmsDeleteTransform(xform); + cmsSignalError(m->ContextID, cmsERROR_CORRUPTION_DETECTED, "Cannot create CLUT table for CRD"); + return 0; + } _cmsIOPrintf(m, "<<\n"); _cmsIOPrintf(m, "/ColorRenderingType 1\n");