Integrated: 8356137: GifImageDecode can produce opaque image when disposal method changes

Jeremy Wood duke at openjdk.org
Fri Jul 11 05:50:50 UTC 2025


On Mon, 5 May 2025 17:07:11 GMT, Jeremy Wood <duke at openjdk.org> wrote:

> This resolves a gif parsing bug where an unwanted opaque rectangle could appear under these conditions:
> 
> 1. The disposal method for frames is 1 (meaning "do not dispose", aka "DISPOSAL_SAVE")
> 2. The transparent pixel is non-zero
> 3. There's more than one such consecutive frame
> 
> Previously: the GifImageDecoder would leave the saved_image pixels as zero when they were supposed to be transparent. This works great if the transparent pixel index is zero, but it flood fills the background of your frame with the zeroeth color otherwise.
> 
> I wrote four PRs that share the GifComparison class in this PR. Once any of them clear code review the other PRs will be much simpler:
> 
> 1. [8357034](https://github.com/openjdk/jdk/pull/25264)
> 2. [8356137](https://github.com/openjdk/jdk/pull/25044) (this one)
> 3. [8356320](https://github.com/openjdk/jdk/pull/25076)
> 4. [8351913](https://github.com/openjdk/jdk/pull/24271)
> 
> This bug can be observed reading these gif animations:
> 
> https://pixabay.com/gifs/cat-kitten-black-cats-pet-animal-20315/
> https://free-gifs.org/gif/CC0-3D

This pull request has now been integrated.

Changeset: 529049be
Author:    jeremy <jeremy.wood at mac.com>
Committer: Jayathirth D V <jdv at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/529049be6b6b39651713d256bb4a6efb7d822674
Stats:     618 lines in 4 files changed: 617 ins; 0 del; 1 mod

8356137: GifImageDecode can produce opaque image when disposal method changes

Reviewed-by: jdv, prr

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

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


More information about the client-libs-dev mailing list