image-rs / jpeg-decoder

JPEG decoder written in Rust
Apache License 2.0
147 stars 88 forks source link

Failed to decode progressive JPEG #130

Open alu opened 4 years ago

alu commented 4 years ago

may be relevant

lovasoa commented 4 years ago

Can you provide an image that triggers the error ? If possible, the image should not be copyrighted so that it can be redistributed freely with the test data for this repository.

alu commented 4 years ago

@lovasoa

Sorry, i can't do it because images that the problem occurs are owned by our customers. I looking for user of those hardware in my company but probably not present.

enzzc commented 4 years ago

I had the same issue with one specific image from my collection. This picture has been taken with a Samsung Galaxy J3 (SM-J320FN).

Version: jpeg-decoder = "0.1", compiled with Rust 1.36.0

Code:

fn main() {
    let file = File::open("/home/enz/Images/bug_imgrust.jpg").expect("failed to open file");
    let mut decoder = jpeg::Decoder::new(BufReader::new(file));
    let pixels = decoder.decode().expect("failed to decode image");
    let metadata = decoder.info().unwrap();
}

Error:

thread 'main' panicked at 'failed to decode image: Format("spectral selection is not allowed in non-progressive scan")', src/libcore/result.rs:999:5

For this particular image of my collection, the identify -verbose command complains with the following message:

identify-im6.q16: Invalid SOS parameters for sequential JPEG `/home/enz/Images/bug_imgrust.jpg' @ warning/jpeg.c/JPEGWarningHandler/352.

I don't know if that SOS stuff can have a relationship with the present problem. Maybe it's just a coincidence, but just in case, it can be worth mentioning.

I can send you the picture by email (I appear in this photo).

qarmin commented 3 years ago

Finally I find image which cause this error - 20190821_154545.jpg.zip

biot023 commented 3 years ago

+1 -- we're seeing this in our app, too.