jpeg-decoder
jpeg-decoder copied to clipboard
panic only when release
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?
Sounds like a bug. Are you able to provide an example image and a code snippet that causes the crash?
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.

P.S. My OS is Archlinux, rust compiler version is 1.54.0
Hm, I was unable to replicate this on Ubuntu or Arch