From 736a76259cfea9cd65db2c7ffefc625463db8f9e Mon Sep 17 00:00:00 2001 From: Marti Maria Date: Wed, 1 May 2024 10:43:43 +0200 Subject: [PATCH] Change computation of profile ID to follow actual ICC spec 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 --- src/cmsmd5.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmsmd5.c b/src/cmsmd5.c index 4105d525..b6cac682 100644 --- a/src/cmsmd5.c +++ b/src/cmsmd5.c @@ -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) { @@ -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));