image icon indicating copy to clipboard operation
image copied to clipboard

Error when decoding unsupported animated webp, instead of panic

Open PhilipK opened this issue 2 years ago • 4 comments

This solves a panic that would happen if a frame was not the same height and width as the image info

This solves the following issue: https://github.com/image-rs/image/issues/1775

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

PhilipK avatar Aug 22 '22 16:08 PhilipK

The panic will only happen if the frame dimension size is different from the info dimension size.

PhilipK avatar Aug 22 '22 17:08 PhilipK

I agree. This is a patch to stop a panic, not a rewrite of the underlying problem.

As a user of a rust library a panic is just about the worst case scenario, because there is really nothing you can do to handle it or prevent it.

Another suggestion here is to gracefully return an error instead of a panic. But I opted for the option that will result in a "good enough for now" result, and then we can work on the real solution.

PhilipK avatar Aug 22 '22 18:08 PhilipK

Gracefully returning an error would be a better way towards working to a real solution. Wrong results easily become (improperly) relied upon before they are fixed. The library explicitly has an Unsupported error variant for these cases. So changing it to return that instead would be appreciated :+1:

HeroicKatora avatar Aug 22 '22 18:08 HeroicKatora

An error is returned instead of a panic now. I added a "is_supported" function, but this can ofc be completely removed once the real cause of the problem is solved.

PhilipK avatar Aug 22 '22 20:08 PhilipK

Now that #2148 is merged, this cannot be merged and should be closed I guess?

link2xt avatar Apr 03 '24 21:04 link2xt

#1775 is also closed already.

link2xt avatar Apr 03 '24 21:04 link2xt