Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PngDecoder::with_limits #1812

merged 1 commit into from Nov 2, 2022


Copy link

@fintelia fintelia commented Oct 25, 2022

This isn't the most elegant solution given that other decoders use ImageDecoder::set_limits, but idiosyncrasies of the PNG format make that interface non-ideal. Specifically, finding out whether the image is animated (contains an acTL chunk) or has a "simple alpha channel" (contains a tRNS chunk) potentially requires scanning a nearly unbounded number of chunks. Worse, we currently don't have a Seek bound on the reader, so we have to store all the chunks we read in case we need them later.

Fixes #1788

Copy link
Contributor Author

fintelia commented Nov 2, 2022

@HeroicKatora does this look reasonable to you?

Copy link

@HeroicKatora HeroicKatora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It kind of does, we'll just see about with_limits and the need to change it at runtime. This is certainly the more cautious approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

InsufficientMemory error while trying to decode
2 participants