jpeg-decoder icon indicating copy to clipboard operation
jpeg-decoder copied to clipboard

panic only when release

Open Athlon64 opened this issue 4 years ago • 3 comments

I was just trying this crate with the simple example on the main webpage. When running it with cargo run, everything was perfect as expected. But when I ran it with cargo run --release, it panicked:

thread 'main' panicked at 'failed to open file: Decoding(DecodingError { format: Exact(Jpeg), underlying: Some(Format("invalid length in DHT")) })', src/main.rs:12:35

and I tried a lot of different jpgs, always the same result.

I am wondering is this a bug or something?

Athlon64 avatar Aug 06 '21 14:08 Athlon64

Sounds like a bug. Are you able to provide an example image and a code snippet that causes the crash?

fintelia avatar Aug 08 '21 18:08 fintelia

Thanks for replying.

The code snippet is as follows:

extern crate jpeg_decoder as jpeg;

use std::fs::File;
use std::io::BufReader;

fn main() {
    let file = File::open("test.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();
}

I just copied the example and changed the name of the image to mine. The image was downloaded from the Internet and attached below.

test

P.S. My OS is Archlinux, rust compiler version is 1.54.0

Athlon64 avatar Aug 09 '21 07:08 Athlon64

Hm, I was unable to replicate this on Ubuntu or Arch

fintelia avatar Aug 15 '21 15:08 fintelia