Skip to content

Commit

Permalink
Add a check for wrong CRD parameters
Browse files Browse the repository at this point in the history
Detect wrong parameters on CRD creation
  • Loading branch information
mm2 committed Apr 11, 2024
1 parent dbb4a1a commit 1176e61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cmsps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 1176e61

Please sign in to comment.