Repository navigation
[59_maintenance] fix(parquet): reject Thrift list sizes larger than remaining input - #11353
Merged
Merged
Conversation
…pache#10979) # Which issue does this PR close? - Closes apache#10920. # Rationale for this change `read_thrift_vec` reserved `Vec` capacity from the compact list header's declared element count before reading any element. A 23-byte footer whose `schema` list claimed ~109 million `SchemaElement`s asked for ~10 GB. Allocation failure aborts the process; `ParquetMetaDataReader` never returns an error. Each list element occupies at least one byte on the wire, so the declared size can be bounded by the bytes remaining in the metadata slice. That slice is already length-limited by the footer; this check is the level below. # What changes are included in this PR? - `ThriftCompactInputProtocol::remaining_bytes` reports unread length for slice-backed input (`ThriftSliceInputProtocol`). Stream-backed input (`ThriftReadInputProtocol`) leaves it unset. - `read_thrift_vec` returns `ParquetError::General` when the declared size exceeds remaining input, and only then calls `Vec::with_capacity`. No public API change. # Are these changes tested? Unit tests in `parquet_thrift`: - well-formed 2-element `i32` list still decodes - 14-element header with no payload returns an error - declared size 109_002_364 with two leftover bytes returns an error (the schema-list case from the issue) `cargo test -p parquet --lib parquet_thrift` and `cargo clippy -p parquet --lib --tests --all-features -- -D warnings`. # Are there any user-facing changes? Malformed footers that previously aborted now return `ParquetError`. Valid files are unchanged. # AI Disclosure Assisted draft of the remaining-bytes check and regression tests. Reviewed against the compact protocol list encoding and verified with the tests above. Co-authored-by: Marcelo Tesla <[email protected]>
This was referenced Oct 3, 2026
Contributor
Author
|
looks like ill need to modify the let chain since that was stabilized in 1.88, but branch 59 has msrv of 1.85 |
alamb
approved these changes
Oct 5, 2026
Contributor
|
Updating to get clean CI run |
Contributor
|
🚀 |
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.
59.3.1(October 2026) #11352Cherry-pick of 7e3b403 + minor fix to destructure let chain (syntactic change)