image-rs / image-gif

GIF en- and decoder
Apache License 2.0
148 stars 42 forks source link

Debug assert zero-sized frames #174

Closed kornelski closed 6 months ago

kornelski commented 6 months ago

There are probably real-world broken GIF files with 0-sized frames, and this could affect users transcoding such files, so I don't want to make it a hard error. But it may be a debug assert, catching programming errors, and making handling of it the application's problem.

Fixes #135

fintelia commented 6 months ago

If a user complains that they're hitting a panic when transcoding zero-sized frames, "compile in release mode" feels like the wrong advice to give. Perhaps instead assert in all modes, but add a allow_zero_size_frames (or similar) method that disables the assert?

kornelski commented 6 months ago

My suggestion would be "filter out 0-sized frames before passing them to the encoder". They don't serve any purpose, so I think it should be on the callers to weed them out.