Skip to content

Commit

Permalink
Change computation of profile ID to follow actual ICC spec
Browse files Browse the repository at this point in the history
From old spec 4.0.0 (ICC1-V40.pdf, ICC.1:2001-12) to actual one there is a breaking change that makes computation of profile ID different. This commit uses the latest spec 4.4.- The change is the requirement to set header flags to zero instead of attributes when computing the MD5 digest.
Thanks to Timo Kinnunen (@Overruler) for detecting and reporting the issue. This commit should fix #447
  • Loading branch information
mm2 committed May 1, 2024
1 parent c646a72 commit 736a762
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmsmd5.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ void CMSEXPORT cmsMD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle)


// Assuming io points to an ICC profile, compute and store MD5 checksum
// In the header, rendering intentent, attributes and ID should be set to zero
// before computing MD5 checksum (per 6.1.13 in ICC spec)
// In the header, rendering intentent, flags and ID should be set to zero
// before computing MD5 checksum (per 7.2.18 of ICC spec 4.4)

cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile)
{
Expand All @@ -270,8 +270,8 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile)
// Save a copy of the profile header
memmove(&Keep, Icc, sizeof(_cmsICCPROFILE));

// Set RI, attributes and ID
memset(&Icc ->attributes, 0, sizeof(Icc ->attributes));
// Set RI, flags and ID
Icc ->flags = 0;
Icc ->RenderingIntent = 0;
memset(&Icc ->ProfileID, 0, sizeof(Icc ->ProfileID));

Expand Down

0 comments on commit 736a762

Please sign in to comment.