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

Harshitha Onkar honkar at openjdk.org
Tue Jan 14 18:11:40 UTC 2025


On Tue, 14 Jan 2025 18:01:55 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> ICC_Profile.setData(..) does validation of the specified tag contents and throws an exception if it is not valid. But if the tag represents the header, at least some of the validation is lazy, occurring only when the data is used, leading to unexpected exceptions at a later time. The check should be done up-front when the data is set, as in other cases.
>> 
>>  `verifyHeader(byte[] data)`is called when header data is being updated and the following fields are validated according to the ICC Spec Document. [[1] Pg#19](https://www.color.org/specification/ICC.1-2022-05.pdf). 
>> 
>> - Profile/Device class
>> - Color Space
>> - Rendering Intent
>> - PCS
>> - Header Size check (ICC Header Size = 128 bytes)
>> 
>> These validation checks are added to ICC_Profile.getInstance(..) & ICC_Profile.setData(..) methods.
>> 
>> Reference: [1] https://www.color.org/specification/ICC.1-2022-05.pdf
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   IAE exception msg updated

src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java line 148:

> 146:                 && profileClass != ICC_Profile.CLASS_NAMEDCOLOR
> 147:                 && profileClass != ICC_Profile.CLASS_ABSTRACT) {
> 148:             throw new IllegalArgumentException("Invalid profile class");

IAE for device or profile class.

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

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


More information about the client-libs-dev mailing list