From fbd3f3e7cd0b327f71875cafc4f7012e929067aa Mon Sep 17 00:00:00 2001 From: nathaniel-daniel <80441888+nathaniel-daniel@users.noreply.github.com> Date: Fri, 22 Mar 2024 21:17:03 -0700 Subject: [PATCH] Remove JPEG size limits while parsing header (#2175) --- src/codecs/jpeg/decoder.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/codecs/jpeg/decoder.rs b/src/codecs/jpeg/decoder.rs index 2fc51c1780..895b471e91 100644 --- a/src/codecs/jpeg/decoder.rs +++ b/src/codecs/jpeg/decoder.rs @@ -28,7 +28,10 @@ impl JpegDecoder { 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