Image: `image` fails to load JPEG images containing zero-length DHT segments

Created on 25 Aug 2019  路  1Comment  路  Source: image-rs/image

This has been fixed on master of jpeg-decoder (https://github.com/kaksmet/jpeg-decoder/pull/94) but jpeg-decoder hasn't published a new version to crates.io yet. I'm not sure what the right thing to do about that is. I assume it's incorrect to depend on a specific commit in their repo, instead of a published version. It might be possible to reach out to the owner of jpeg-decoder and ask him to publish a new version. Regardless, I feel there should be something tracking this issue on the main image crate. Most people who encounter this will not be aware of the details of the JPEG format, and will come here first.

I encountered it by trying to load a JPG produced by my Samsung smartphone; the user who fixed it in jpeg-decoder discovered it in a similar way.

Expected

JPEG images with zero-length DHT segments are parsed correctly. There's an example in the PR linked above.

Actual behaviour

Such images fail to load with errors like

ImageError { error: FormatError("encountered APP(5) with invalid length 2") }

Reproduction steps

Try to load the image linked in the above PR.

bug

Most helpful comment

jpeg-decoder 0.1.16 has been published

>All comments

jpeg-decoder 0.1.16 has been published

Was this page helpful?
0 / 5 - 0 ratings