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

Harshitha Onkar honkar at openjdk.org
Tue Jan 28 02:10:57 UTC 2025


On Tue, 28 Jan 2025 00:48:33 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>Note, before this fix the following method iccCStoJCS was used to convert icc constant to java constant and if it was not possible an exception was thrown. 
 
Agreed.

> One of the reasons it was not possible is because we do not cover all variants as java constants so we cannot return anything useful from getPCSType/etc, but it was still possible to use such profiles for color conversion.

But the exception that I mentioned here: https://github.com/openjdk/jdk/pull/23044#discussion_r1929879100 is WITHOUT the newly added validation checks in setData(). 

The test case for that I used is as follows


 ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
 ICC_Profile sRGB = ICC_Profile.getInstace(ColorSpace.CS_sRGB);
 sRGB.setData()  // changed the color space to cmsSigMCH1Data which is not in JDK and commented out the validation checks
 cs.toRGB(new float[3]); //color transform from CS_LINEAR_RGB to CS_sRGB fails

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

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


More information about the client-libs-dev mailing list