[jdk21u-dev] RFR: 8351110: ImageIO.write for JPEG can write corrupt JPEG for certain thumbnail dimensions

duke duke at openjdk.org
Mon Nov 24 16:03:01 UTC 2025


On Thu, 13 Nov 2025 23:24:19 GMT, Roland Mesde <duke at openjdk.org> wrote:

> Backporting JDK-8351110: ImageIO.write for JPEG can write corrupt JPEG for certain thumbnail dimensions. JPEG segments have a 65535-byte limit, but the code was writing larger segments, causing parsing errors when reading files back.
> 
> Two fixes implemented:
> 
> 1. Constrains thumbnail dimensions to fit within the segment limit.
> 
> 2. Added safety check to write2bytes that throws IIOException if segment size is exceeded.
> 
> Ran GHA Sanity Checks (passed) and related test (passed).

@rm-gh-8 
Your change (at version 12492032dc78e63ab237d5d7ae784c8b20f01bce) is now ready to be sponsored by a Committer.

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

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2471#issuecomment-3571534905


More information about the jdk-updates-dev mailing list