RFR: 8351913: ToolkitImage renders some gifs wrong [v8]
Jeremy Wood
duke at openjdk.org
Mon Aug 4 17:03:04 UTC 2025
On Mon, 4 Aug 2025 05:59:41 GMT, Jeremy Wood <duke at openjdk.org> wrote:
>> I do not have much background in LZW compression or in C, but I'm reasonably confident this resolves the problem I'm observing. It looks like the GifImageDecoder was not always correctly handling compression codes after the table reached its limit of ~4096. If anyone has suggestions for improvements I'm happy to make adjustments.
>>
>> Luckily while debugging this: I was able to compare the flawed implementation (GifImageDecoder) with ImageIO's implementation (GIFImageReader) to help identify how the suffix/prefix tables are supposed to work.
>>
>> ImageIO's implementation may have suffered a similar bug (maybe https://bugs.openjdk.org/browse/JDK-7131823 ?), and that appears to have been backported.
>>
>> There are a cluster of four related PRs that share the GifComparison class in this PR.
>>
>> 1. [8357034](https://github.com/openjdk/jdk/pull/25264)
>> 2. ~~[8356137](https://github.com/openjdk/jdk/pull/25044)~~ (integrated)
>> 3. [8356320](https://github.com/openjdk/jdk/pull/25076)
>> 4. [8351913](https://github.com/openjdk/jdk/pull/24271) (this one)
>>
>> This bug can be observed reading these gif animations:
>> https://pixabay.com/gifs/pattern-mandela-geometric-loading-20162/
>> https://pixabay.com/gifs/colourful-paint-spiral-pattern-20276/
>> https://pixabay.com/gifs/dance-party-dancer-dancing-girl-19993/
>> https://pixabay.com/gifs/spiral-orbit-colourful-pattern-20278/
>> https://pixabay.com/gifs/flower-smiley-happy-yellow-bright-11997/
>> https://pixabay.com/gifs/ghost-spooky-halloween-horror-20223/
>> https://pixabay.com/gifs/fish-tadpole-sperm-decorative-20078/
>> https://pixabay.com/gifs/cat-kitten-black-cats-sleep-nap-20104/
>> https://giphy.com/gifs/party-gzhreEYEFrEYw
>> https://giphy.com/gifs/hello-happy-birthday-all-xRVUlSCqTTZRLMdUiC
>> https://giphy.com/gifs/GpANv0ZGOo973DNPyg
>> https://giphy.com/gifs/pinatafarmsapp-birthday-happy-pinata-farms-rrmf3fICPZWg1MMXOW
>> https://pixabay.com/gifs/stars-twinkle-sky-universe-cosmos-13910/
>> https://pixabay.com/gifs/laundry-washing-clean-clothes-18875/
>> https://giphy.com/gifs/cat-white-mikitti-VItynXR1BzF5z0aTM7
>> https://giphy.com/gifs/love-good-morning-cute-sTuKV3kHCkuc1hzd5C
>> https://giphy.com/gifs/tv2norge-dance-celebration-birthday-duNowzaVje6Di3hnOu
>> https://tenor.com/view/hasher-sticker-gif-24531859
>> https://giphy.com/gifs/animanias-emoji-mickey-mouse-minnie-BeiTtDrExJZsoHzglJ
>> https://giphy.com/gifs/morning-good-gm-dvwk9tqWYN8Wn2s4yn
>> https://giphy.com/gifs/memoriachilena-familia-memoria-chilena-patrimo...
>
> Jeremy Wood has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 34 commits:
>
> - Merge branch 'master' into JDK-8351913
> - 8351913: re-wrapping line breaks
> - Merge branch 'master' into JDK-8351913
>
> # Conflicts:
> # test/jdk/sun/awt/image/gif/GifComparison.java
> - Merge branch 'master' into JDK-8351913
> - 8356137: Adding copyright to GifComparison
> - 8356320: trivial whitespace and comment changes
> - Merge branch 'master' into JDK-8351913
> - Merge branch 'master' of https://github.com/mickleness/jdk
> - 8351913: renaming class, rewording comment
>
> There's a cluster of 4 related gif tickets I intend to put in this /gif/ directory. I want to better clarify exactly what this test focuses on.
> - GifComparison: fixing error message
> - ... and 24 more: https://git.openjdk.org/jdk/compare/57553ca1...ad69988d
Once https://github.com/openjdk/jdk/pull/25264 is merged (specifically https://github.com/openjdk/jdk/pull/25264/commits/b418a02d1d8854d58aa8da9805c69e1ddd640502 ) this will include some new image dumping logic for debugging. I'll remove `rfr` for now until that ticket is merged.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24271#issuecomment-3151588621
More information about the client-libs-dev
mailing list