Skip to content

Commit

Permalink
Remove JPEG size limits while parsing header (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-daniel committed Mar 23, 2024
1 parent e8b7acb commit fbd3f3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codecs/jpeg/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ impl<R: BufRead + Seek> JpegDecoder<R> {
let mut input = Vec::new();
let mut r = r;
r.read_to_end(&mut input)?;
let mut decoder = zune_jpeg::JpegDecoder::new(input.as_slice());
let options = zune_core::options::DecoderOptions::default()
.set_max_width(usize::MAX)
.set_max_height(usize::MAX);
let mut decoder = zune_jpeg::JpegDecoder::new_with_options(input.as_slice(), options);
decoder.decode_headers().map_err(ImageError::from_jpeg)?;
// now that we've decoded the headers we can `.unwrap()`
// all these functions that only fail if called before decoding the headers
Expand Down

0 comments on commit fbd3f3e

Please sign in to comment.