From 5c3d3db0d71970566ee15200ffb7141d1e729ea4 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 26 Mar 2024 18:29:56 +0100 Subject: [PATCH] Disable strict mode for JPEG decoder (#2183) --- src/codecs/jpeg/decoder.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/codecs/jpeg/decoder.rs b/src/codecs/jpeg/decoder.rs index 895b471e91..adb6751d88 100644 --- a/src/codecs/jpeg/decoder.rs +++ b/src/codecs/jpeg/decoder.rs @@ -29,6 +29,7 @@ impl JpegDecoder { let mut r = r; r.read_to_end(&mut input)?; let options = zune_core::options::DecoderOptions::default() + .set_strict_mode(false) .set_max_width(usize::MAX) .set_max_height(usize::MAX); let mut decoder = zune_jpeg::JpegDecoder::new_with_options(input.as_slice(), options); @@ -133,8 +134,9 @@ fn new_zune_decoder( limits: Limits, ) -> zune_jpeg::JpegDecoder<&[u8]> { let target_color_space = to_supported_color_space(orig_color_space); - let mut options = - zune_core::options::DecoderOptions::default().jpeg_set_out_colorspace(target_color_space); + let mut options = zune_core::options::DecoderOptions::default() + .jpeg_set_out_colorspace(target_color_space) + .set_strict_mode(false); options = options.set_max_width(match limits.max_image_width { Some(max_width) => max_width as usize, // u32 to usize never truncates None => usize::MAX,