Skip to content

Decoding a partial file causes "cannot seek vector iterator after end" error

Issue description

decode-6266d637dcc2d777.exe!std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<jxl::Channel> > >::_Verify_offset(const __int64 _Off) Line 113 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:113)
decode-6266d637dcc2d777.exe!std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<jxl::Channel> > >::operator+=(const __int64 _Off) Line 120 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:120)
decode-6266d637dcc2d777.exe!std::_Vector_iterator<std::_Vector_val<std::_Simple_types<jxl::Channel> > >::operator+=(const __int64 _Off) Line 282 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:282)
decode-6266d637dcc2d777.exe!std::_Vector_iterator<std::_Vector_val<std::_Simple_types<jxl::Channel> > >::operator+(const __int64 _Off) Line 288 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\vector:288)
decode-6266d637dcc2d777.exe!jxl::MetaSqueeze(jxl::Image & image, std::vector<jxl::SqueezeParams,std::allocator<jxl::SqueezeParams> > * parameters) Line 433 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\modular\transform\squeeze.h:433)
decode-6266d637dcc2d777.exe!jxl::Transform::MetaApply(jxl::Image & input) Line 92 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\modular\transform\transform.cc:92)
decode-6266d637dcc2d777.exe!jxl::ModularDecode(jxl::BitReader * br, jxl::Image & image, jxl::GroupHeader & header, unsigned __int64 group_id, jxl::ModularOptions * options, const std::vector<jxl::PropertyDecisionNode,std::allocator<jxl::PropertyDecisionNode> > * global_tree, const jxl::ANSCode * global_code, const std::vector<unsigned char,std::allocator<unsigned char> > * global_ctx_map, bool allow_truncated_group) Line 405 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\modular\encoding\encoding.cc:405)
decode-6266d637dcc2d777.exe!jxl::ModularGenericDecompress(jxl::BitReader * br, jxl::Image & image, jxl::GroupHeader * header, unsigned __int64 group_id, jxl::ModularOptions * options, int undo_transforms, const std::vector<jxl::PropertyDecisionNode,std::allocator<jxl::PropertyDecisionNode> > * tree, const jxl::ANSCode * code, const std::vector<unsigned char,std::allocator<unsigned char> > * ctx_map, bool allow_truncated_group) Line 507 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\modular\encoding\encoding.cc:507)
decode-6266d637dcc2d777.exe!jxl::ModularFrameDecoder::DecodeGlobalInfo(jxl::BitReader * reader, const jxl::FrameHeader & frame_header, bool allow_truncated_group) Line 211 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\dec_modular.cc:211)
decode-6266d637dcc2d777.exe!jxl::FrameDecoder::ProcessDCGlobal(jxl::BitReader * br) Line 400 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\dec_frame.cc:400)
decode-6266d637dcc2d777.exe!jxl::FrameDecoder::ProcessSections(const jxl::FrameDecoder::SectionInfo * sections, unsigned __int64 num, jxl::FrameDecoder::SectionStatus * section_status) Line 659 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\dec_frame.cc:659)
decode-6266d637dcc2d777.exe!jxl::`anonymous namespace'::JxlDecoderProcessInternal(JxlDecoderStruct * dec, const unsigned char * in, unsigned __int64 size) Line 993 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\decode.cc:993)
decode-6266d637dcc2d777.exe!JxlDecoderProcessInput(JxlDecoderStruct * dec) Line 1372 (c:\Users\Kagami\Documents\GitHub\jxl-rs\libjxl-src\submodules\jpeg-xl\lib\jxl\decode.cc:1372)
decode-6266d637dcc2d777.exe!kagamijxl::decode::decode_loop<slice<u8>>(libjxl_sys::JxlDecoderStruct * dec, slice<u8> data, libjxl_sys::JxlPixelFormat * pixel_format, int event_flags, core::option::Option<usize> max_frames, bool allow_partial) Line 189 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\src\decode.rs:189)
decode-6266d637dcc2d777.exe!kagamijxl::decode::decode_oneshot<slice<u8>>(slice<u8> data, kagamijxl::decode::Decoder * dec) Line 310 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\src\decode.rs:310)
decode-6266d637dcc2d777.exe!kagamijxl::decode::Decoder::decode_buffer<slice<u8>>(slice<u8> self) Line 358 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\src\decode.rs:358)
decode-6266d637dcc2d777.exe!kagamijxl::decode::Decoder::decode(slice<u8> self) Line 350 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\src\decode.rs:350)
decode-6266d637dcc2d777.exe!decode::test_decode_partial_2() Line 187 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\tests\decode.rs:187)
decode-6266d637dcc2d777.exe!decode::test_decode_partial_2::{{closure}}(decode::test_decode_partial_2::closure-0 *) Line 181 (c:\Users\Kagami\Documents\GitHub\jxl-rs\kagamijxl\tests\decode.rs:181)
decode-6266d637dcc2d777.exe!core::ops::function::FnOnce::call_once<closure-0,tuple<>>(decode::test_decode_partial_2::closure-0) Line 227 (c:\Users\Kagami\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:227)

image.channel.begin() + offset + c - beginc inside MetaSqueeze fails when decoding cat.jxl sliced in 0-40960 byte range. The length of channel is 3, offset is 3, c is 1, and beginc is 1.

Environment

Operating System: Windows 10

JPEG XL software version: 0.3.3

Compilation: Rust binding

CPU / architecture / device: Intel Core i7-1065G7

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information