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

Fix decoding invalid color combinations #223

Merged
merged 2 commits into from
Jun 17, 2020

Conversation

HeroicKatora
Copy link
Member

The calculation for buffer size used a different path than the color
used during actual decoding, especially when the flags would expand
colors. This would only panic during the decoding of interlaced images.
For standard images the remaining data would simply get dropped.

Closes: #222

The calculation for buffer size used a different path than the color
used during actual decoding, especially when the flags would expand
colors. This would only panic during the decoding of interlaced images.
For standard images the remaining data would simply get dropped.
@HeroicKatora
Copy link
Member Author

That apparently fixed it but I'm having a hard time figuring out exactly which combination of inputs would differ, and which one is intended or correct..

src/common.rs Show resolved Hide resolved
src/common.rs Show resolved Hide resolved
@HeroicKatora
Copy link
Member Author

Actually, the color combination in the failing image (RGBA/2-bit) is not allowed per specification. This makes the whole fix appear under a different light, even our encoder rejects it since a recent commit ;)

This is no longer really necessary since color types would be treated
somewhat correctly. However, let's restrict ourselves to the
standardized color types for now.
@HeroicKatora HeroicKatora changed the title Fix output buffer size Fix decoding invalid color combinations Jun 17, 2020
@HeroicKatora HeroicKatora merged commit 9280826 into image-rs:master Jun 17, 2020
@HeroicKatora HeroicKatora deleted the output-buffer-size branch June 17, 2020 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

out-of-bounds panic in utils::expand_pass
2 participants