Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic only when release #194

Open
Athlon64 opened this issue Aug 6, 2021 · 3 comments
Open

panic only when release #194

Athlon64 opened this issue Aug 6, 2021 · 3 comments

Comments

@Athlon64
Copy link

Athlon64 commented Aug 6, 2021

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?

@fintelia
Copy link
Contributor

fintelia commented Aug 8, 2021

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

@Athlon64
Copy link
Author

Athlon64 commented Aug 9, 2021

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

@fintelia
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants