Skip to content

Fix webp magic bytes#937

Merged
197g merged 2 commits intoimage-rs:masterfrom
birktj:webp-magic
May 5, 2019
Merged

Fix webp magic bytes#937
197g merged 2 commits intoimage-rs:masterfrom
birktj:webp-magic

Conversation

@birktj
Copy link
Copy Markdown
Member

@birktj birktj commented May 5, 2019

Magic bytes for webp are wrong.
This fixes #660

@martinlindhe
Copy link
Copy Markdown
Member

If you have a small valid webp image handy, could you possibly also add this to this PR into tests/images/webp or something? Seems like we currently lack any samples.

@martinlindhe
Copy link
Copy Markdown
Member

Also, I think in the long run this may not be an optimal solution as RIFF is a container format. However I much prefer header based format detection than full blown format parsers, but again we may have to.

For example TGA cannot simply be detected with magic bytes, one would need to parse more of the file to conclude its valid TGA.

@birktj
Copy link
Copy Markdown
Member Author

birktj commented May 5, 2019

I agree, but I think that would be for a later PR. For now webp is the only image format supported by this library where the file can start with RIFF so I assume this should be safe for now.

@martinlindhe
Copy link
Copy Markdown
Member

Yea, for sure. The only other format using RIFF container I'm aware of that's even remotely resembling our use case is Windows 95 animated cursors (.ANI).

@197g 197g merged commit 39a316a into image-rs:master May 5, 2019
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.

Issue with guessing format of WEBP images

3 participants