RFR: 8356137: GifImageDecode can produce opaque image when disposal method changes [v10]
Jeremy Wood
duke at openjdk.org
Wed Jul 9 19:09:32 UTC 2025
> 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)
Jeremy Wood has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 39 additional commits since the last revision:
- 8354646: rewrapping line breaks so text is < 80 chars
This is in response to:
https://github.com/openjdk/jdk/pull/25044#issuecomment-3051978321
- Merge branch 'master' into JDK-8356137
- 8356137: adding copyright
- 8356137: remove test file now that we use GifBuilder
- 8356137: Use new GifBuilder for 8356137 test case
This is in response to:
https://github.com/openjdk/jdk/pull/25044#pullrequestreview-2871107750
- 8356137: Adding GifBuilder to dynamically create test file
This can be used by multiple gif tests in this directory.
This is in response to:
https://github.com/openjdk/jdk/pull/25044#pullrequestreview-2871107750
- 8356137: trivial javadoc update
- 8356137: only inspect last frame of gif
This makes the main() method much less useful, so I removed it too. (I originally used this class to explore a folder of hundreds of gifs to look for discrepancies. But the discrepancies were rarely only on the last frame.)
This is in response to:
https://github.com/openjdk/jdk/pull/25044#discussion_r2109298270
- 8356137: remove the redundant transparency check
This is in response to:
https://github.com/openjdk/jdk/pull/25044#discussion_r2109318427
- 8356137: flood fill saved_image at initialization
This is in response to:
https://github.com/openjdk/jdk/pull/25044#issuecomment-2912699099
- ... and 29 more: https://git.openjdk.org/jdk/compare/2c88ffdc...e143c8cf
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/25044/files
- new: https://git.openjdk.org/jdk/pull/25044/files/392a9e5f..e143c8cf
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=25044&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=25044&range=08-09
Stats: 135422 lines in 2651 files changed: 81061 ins; 33367 del; 20994 mod
Patch: https://git.openjdk.org/jdk/pull/25044.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25044/head:pull/25044
PR: https://git.openjdk.org/jdk/pull/25044
More information about the client-libs-dev
mailing list