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 WebP decoding #1823

Merged
merged 3 commits into from
Nov 16, 2022
Merged

Fix WebP decoding #1823

merged 3 commits into from
Nov 16, 2022

Conversation

mattfbacon
Copy link
Contributor

Fixes #1775

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

@fintelia
Copy link
Contributor

This looks plausible, but I'm not really familiar with the WebP format. Any chance you could add a test or two?

@mattfbacon
Copy link
Contributor Author

Sure. I have an animated WebP that failed before this patch. I'll add a test that ensures that decoding it doesn't panic.

@mattfbacon
Copy link
Contributor Author

Well, the test I added revealed another issue with the WebP decoder. I guess I'll fix that as well in this PR.

@mattfbacon
Copy link
Contributor Author

Specifically, this code:

https://github.com/image-rs/image/blob/master/src/codecs/webp/extended.rs#L83-L89

is wrong. It should check the color type of the first frame from the actual image data.

Copy link
Member

@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.

One style nit and a question with regards to the format, the code itself looks good to me.

src/codecs/webp/extended.rs Outdated Show resolved Hide resolved
src/codecs/webp/extended.rs Show resolved Hide resolved
@mattfbacon
Copy link
Contributor Author

Fixed

@HeroicKatora HeroicKatora merged commit 1acb3b5 into image-rs:master Nov 16, 2022
@mattfbacon mattfbacon deleted the fix-webp branch November 16, 2022 20:20
@mattfbacon mattfbacon restored the fix-webp branch November 16, 2022 20:20
@mattfbacon mattfbacon deleted the fix-webp branch November 16, 2022 20:20
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.

Panic when an animated webp image is loaded
3 participants