RFR: JDK-8347377 : Add validation checks for ICC_Profile header fields [v9]

Harshitha Onkar honkar at openjdk.org
Mon Jan 27 17:28:56 UTC 2025


On Sun, 26 Jan 2025 21:48:22 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> src/java.desktop/share/classes/java/awt/color/ICC_Profile.java line 1155:
>> 
>>> 1153:             throw new IllegalArgumentException("Invalid header data");
>>> 1154:         }
>>> 1155:         getProfileClass(data);
>> 
>> Can any of these fields have custom values (not covered by java constants inside iccCStoJCS) ​​that can still be used for color transformation?
>
> Using custom values of color space to create a new color transform (For instance: cmsSigMCH1Data: 0x4D434831 which is specified in LCMS API but not in ICC Spec) results in  ProfileDataException as below. (this is expected since cmsSigMCH1Data constant is NOT present in JDK).
> 
> 
> java.awt.color.ProfileDataException: invalid ICC color space
> 	at java.desktop/java.awt.color.ICC_Profile.getNumComponents(ICC_Profile.java:1217)
> 	at java.desktop/sun.java2d.cmm.lcms.LCMSTransform.<init>(LCMSTransform.java:85)
> 	at java.desktop/sun.java2d.cmm.lcms.LCMS.createTransform(LCMS.java:132)
> 	at java.desktop/java.awt.color.ICC_ColorSpace.toRGB(ICC_ColorSpace.java:212)
> 
> 
> To summarize:
> - Profile/Device class -  constants match  (in ICC Spec doc and LCMS API doc)
> - Color Space - constants differ
> - Rendering Intent - constants differ
> - PCS - constants differ. This is dependent on type of device class and takes color space values.

> No, we definitely don't need to add any custom values ​​to the Java API, the question is whether we need to reject them or not, since the ICC specification allows it(?).

Is this question applicable only for Rendering Intent or other fields too?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23044#discussion_r1930905654


More information about the client-libs-dev mailing list