Mola-maker opened a new pull request, #12405: URL: https://github.com/apache/arrow-rs/pull/12405
Closes #10921. This ports the two remaining pieces of telekom/sutura#1930 (geoHeil). The pull path is already bounded on main, so this covers only what is missing. A footer length larger than the file is rejected before the footer buffer is allocated. `FileReaderBuilder::build` now compares the footer length against the file length. It reads the file length from the stream position after the trailer. A negative stream body length is rejected in the push decoder. `StreamDecoder` now converts the body length with `try_from` and returns `ParseError` on failure. Before, a negative length was cast to a huge `usize`, and the decoder waited for more bytes forever. The `MessageReader` pull path is not changed. Main already reads metadata through a `Take` and bodies through `read_body_bounded`, so a declared length cannot force its full allocation there. ## Are these changes tested? Yes. Two new tests. `test_footer_length_is_bounded_by_file_size` feeds a 10-byte file with a footer length of `i32::MAX`. It returns `ParseError` with "Footer extends past file end". `test_negative_body_length_is_an_error` feeds a message with a body length of -1. It returns `ParseError` with "Invalid body length: -1". The negative-body test fails before the fix. The decoder returns `Ok(None)` instead of an error. After the fix, both tests pass. Full `arrow-ipc` lib suite: 152 passed, 0 failed. `cargo fmt --check` and `cargo clippy --all-targets --all-features -D warnings` are clean. Note: the footer test is not run against the old code. It would allocate a 2 GiB footer buffer there. AI usage disclosure: this PR was developed and tested with AI assistance (harness: Muse; model: Muse Spark). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
