RFR: 8358057: Update validation of ICC_Profile header data [v4]

Sergey Bylokhov serb at openjdk.org
Mon Jun 2 19:28:09 UTC 2025


> The [next PR](https://github.com/openjdk/jdk/pull/23044) introduces several new methods to the ICC_Profile class:
> -  getProfileClass(byte[])
> -  getColorSpaceType(byte[])
> -  getPCSType(byte[])
> -  checkRenderingIntent(byte[])
> 
> These new methods extract data directly from the provided byte array rather than relying on the profile instance. The first three methods essentially duplicate the existing ones (getProfileClass(), getColorSpaceType(), getPCSType()).
> 
> It is possible to update implementation:
> - The existing methods getColorSpaceType() and getPCSType() could delegate to the new getColorSpaceType(byte[]) and getPCSType(byte[]) methods.
> - The checkRenderingIntent(byte[]) method could be updated to report the actual invalid intent value when an error occurs
> 
> Tests:
>  - Old ValidateICCHeaderData test is update to verify the new output of the checkRenderingIntent
>  - New RenderingIntentStressTest test is added to check the next part of the icc_spec:
> 
>           * ICC spec: only the least-significant 16 bits encode the rendering
>           * intent. The most significant 16 bits must be zero and can be ignored.
>           * See https://www.color.org/ICC1v42_2006-05.pdf, section 7.2.15.
> 
> 
> 
> @honkar-jdk please take a look.
> 
> Note: There is currently an inconsistency in the usage of `getData(icSigHead)` vs `getData(cmmProfile(), icSigHead)` throughout the codebase. I plan to address this separately.

Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision:

  drop 8337703 bugid

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25519/files
  - new: https://git.openjdk.org/jdk/pull/25519/files/43b88ff3..55d0fe2e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25519&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25519&range=02-03

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/25519.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25519/head:pull/25519

PR: https://git.openjdk.org/jdk/pull/25519


More information about the client-libs-dev mailing list