Closed gizmomogwai closed 1 year ago
Hello,
Normally all failed loading should fail with isError
, so your suggestion is exactly what is intended to happen.
So this is a bug in the decoder if an empty file asserted (which is an input error, not a logic error).
JPEG loader should now gracefully handle bad input, though only fuzzing will tell. Probably leaks a bit of memory on bad input. Use 2.1.2+
This is 2bc035c4b4384e460ffad7e9fa32b24918648e0d
Wow .. that was fast, will give it a try!
Works for my usecase (empty jpg), thanks a lot!
fuzzing is always fun :)
Pleasure. Let me know if you identify annoying things in the library.
First of all thanks for this excellent library. I was able to replace imagefmt quickly with your library (which supports more imageformats and variants.
While testing I encountered
assert(false
calls in stop_decoding (e.g. trying to load a jpeg from an empty file). It would be great if the error handling could be done on application level and the load in this case would return an invalid image.I created a local patch for that (by removing the assert and replacing all calls to stop_decoding with stop_decoding and a return, but I am not sure that this is the best way.