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

Roland Mesde duke at openjdk.org
Mon Nov 24 16:16:03 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).

This pull request has now been integrated.

Changeset: a9b396f8
Author:    Roland Mesde <mesde at amazon.com>
Committer: Paul Hohensee <phh at openjdk.org>
URL:       https://git.openjdk.org/jdk21u-dev/commit/a9b396f8829fe521d1cc37306aaf52b1674577f9
Stats:     168 lines in 3 files changed: 167 ins; 0 del; 1 mod

8351110: ImageIO.write for JPEG can write corrupt JPEG for certain thumbnail dimensions

Backport-of: 60f3d607412dfe289f33dd922dfc1c9ff766810f

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

PR: https://git.openjdk.org/jdk21u-dev/pull/2471


More information about the jdk-updates-dev mailing list