fix(ipc): validate block lengths before allocation - #11012
Open
KHARSHAVARDHAN-eng wants to merge 1 commit into
Open
fix(ipc): validate block lengths before allocation#11012KHARSHAVARDHAN-eng wants to merge 1 commit into
KHARSHAVARDHAN-eng wants to merge 1 commit into
Conversation
Rich-T-kid
reviewed
Sep 7, 2026
| let body_len = block.bodyLength().to_usize().unwrap(); | ||
| let metadata_len = block.metaDataLength().to_usize().unwrap(); | ||
| let total_len = body_len.checked_add(metadata_len).unwrap(); | ||
| let offset = u64::try_from(block.offset()) |
Contributor
There was a problem hiding this comment.
nit: might be worth placing all the parsing Errors into a anon function that takes in a string. either way otherwise this makes sense 👍
Jefffrey
reviewed
Sep 8, 2026
| ArrowError::ParseError("Block body length + metadata length overflowed usize".to_string()) | ||
| })?; | ||
|
|
||
| let file_len = reader.seek(SeekFrom::End(0))?; |
Contributor
There was a problem hiding this comment.
we probably should pass in the file length to the function, instead of re-seeking for every block read
KHARSHAVARDHAN-eng
force-pushed
the
fix-ipc-block-length-allocation
branch
from
September 9, 2026 07:43
b94fc60 to
a4921f1
Compare
Author
|
Thanks for the review! I’ve addressed Jeffrey’s suggestion by calculating the file length once and passing it through to read_block, avoiding repeated end-of-file seeks. The changes have been verified with formatting, clippy, and the full arrow-ipc test suite. Ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10921
Summary
Validation
cargo fmt --checkcargo clippy -p arrow-ipc --all-targets -- -D warningscargo test -p arrow-ipcgit diff --check