RFR: 8270915: GIFImageReader disregards ignoreMetadata flag which causes memory exhaustion

Phil Race prr at openjdk.org
Tue Oct 4 18:43:26 UTC 2022


On Mon, 3 Oct 2022 13:59:25 GMT, Jayathirth D V <jdv at openjdk.org> wrote:

> In https://bugs.openjdk.org/browse/JDK-8270915 we have a valid GIF image which was generated using a third party app, but it contains large amount of Metadata(numerous Application extension blocks).
> 
> Also GIFImageReader doesn't use ignoreMetadata flag set by user while reading Metadata which causes heavy memory usage in this scenario. We need to provide support for ignoring metadata in GIFImageReader, so readMetadata() is updated to use the "ignoreMetadata" flag and ignore all blocks except "Image Descriptor" and "Graphics Control Extension".
> 
> I have updated readMedata() to also use ReaderUtil.staggeredReadByteStream() where we are allocating upfront memory based on parameters from metadata. Also this PR has small refactoring of import statements.
> 
> To replicate the bug we need byte stream with large amount of valid metadata, so i am not able to add regression test case. I have run all javax/imageio jtreg tests and there are no issues.

LGTM

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

Marked as reviewed by prr (Reviewer).

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



More information about the client-libs-dev mailing list