RFR: JDK-8347377 : Add validation checks for ICC_Profile header fields [v3]
Harshitha Onkar
honkar at openjdk.org
Tue Jan 14 20:43:49 UTC 2025
On Tue, 14 Jan 2025 19:50:27 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
>>> **void cmsSetColorSpace(cmsHPROFILE hProfile, cmsColorSpaceSignature sig);**
>>>
>>> Sets the color space signature in profile header, using ICC convention.
>>> Parameters:
>>> hProfile: Handle to a profile object
>>> sig: any cmsColorSpaceSignature from Table 10
>>> Returns:
>>> *None*
>>
>>> for example for the next method is it assumed that the client code should check the content of Table 10, and reject all incorrect values?:
>>
>> Based on the API doc,looks like LCMS expects client code (jdk) to validate the values before updating it using cmsSet**() APIs. I can double-check with the LCMS maintainers for clarity.
>
>> for example for the next method is it assumed that the client code should check the content of Table 10, and reject all incorrect values?
>
> We can choose to add these validation checks to jdk which makes the code more robust and ensures that the profiles adhere to ICC Specification whether or not LCMS APIs expect to validate it.
> our own profiles do not strictly follow these specification, so if lcms ignores that we can do the same, especially since we fallback to the "Perceptual intent"
>
> https://github.com/openjdk/jdk/blob/13a1775718f329b02cdeb82f9d3f7d878ac5e771/src/java.desktop/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java#L75
>the new code will be called when loading raw data for a profile, so if that profile was previously accepted and used some default values, the new code will reject it.
@prrace @mrserb
There is difference in what is stated as accepted values for Rendering Intent in **[ICC Spec Doc](https://www.color.org/specification/ICC.1-2022-05.pdf) vs [LittleCMS API doc](https://www.littlecms.com/LittleCMS2.16%20API.pdf)**
**ICC Spec Doc** states Rendering Intent can take one of the following values [Pg#23]:
<img width="353" alt="image" src="https://github.com/user-attachments/assets/cdd62ca5-0cd0-4c2f-afa6-1777f20c643c" />
----
**The API doc** states it can take ICC Intent as well as Non-ICC Intent values [Pg#88,90]
void cmsSetHeaderRenderingIntent(cmsHPROFILE hProfile,
cmsUInt32Number RenderingIntent);
Sets the profile header rendering intent. See the discussion above.
Parameters:
hProfile: Handle to a profile object
RenderingIntent: A cmsUInt32Number holding the intent code, as described in
Intents section
<img width="485" alt="image" src="https://github.com/user-attachments/assets/ffe5dae6-25ae-48b5-8d31-68091635e610" />
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23044#discussion_r1915571810
More information about the client-libs-dev
mailing list