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

Sergey Bylokhov serb at openjdk.org
Fri Jan 31 01:03:58 UTC 2025


On Tue, 28 Jan 2025 02:16:02 GMT, Harshitha Onkar <honkar 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.
>> 
>>> but it was still possible to use such profiles for color conversion.
>> 
>> 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 present in JDK and commented out the validation checks in setData()
>>  cs.toRGB(new float[3]); //color transform from CS_LINEAR_RGB to CS_sRGB fails, java.awt.color.ProfileDataException: invalid ICC color space thrown during color conversion.
>
>> But the existing checks that are already in the constructor can be safely added.
> 
> Did you mean: profile class and color space validation checks should be okay to add to .setData() ?

Everything we've already checked in the constructor is fine.

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

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


More information about the client-libs-dev mailing list