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

Faster BMP and JPEG decoding with any backend #1878

Closed
wants to merge 16 commits into from
Prev Previous commit
Next Next commit
Fix infinite recursion in PNM
Shnatsel committed Mar 11, 2023
commit 6e3eb65dd160f47d582445ee584324bbaffc95c4
4 changes: 3 additions & 1 deletion src/codecs/pnm/decoder.rs
Original file line number Diff line number Diff line change
@@ -614,8 +614,10 @@ impl<'a, R: 'a + Read> ImageDecoder<'a> for PnmDecoder<R> {
}

fn into_reader(self) -> ImageResult<Self::Reader> {
let mut buf = vec![0; self.total_bytes() as usize];
self.read_image(&mut buf)?;
Ok(PnmReader(
Cursor::new(image::decoder_to_vec(self)?),
Cursor::new(buf),
PhantomData,
))
}