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

Harshitha Onkar honkar at openjdk.org
Sun Jan 26 21:50:47 UTC 2025


On Fri, 24 Jan 2025 01:03:35 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Runtime Exception added
>
> 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.

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.

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

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


More information about the client-libs-dev mailing list