Repository navigation
Conversation
| decompressor, | ||
| state, | ||
| physical_type: meta.column_type(), | ||
| column_uncompressed_size: meta.uncompressed_size(), |
Member
There was a problem hiding this comment.
Isn't this a value (potentially untrusted) that comes from the same file?
Contributor
There was a problem hiding this comment.
having a stricter check here per this PR can have some value, but yes it does still leave a potential loophole via the uncompressed size field if we're aiming to fully close the loophole 🤔
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
Contributor
|
The PR appears abandoned -- please respond to feedback and reopen if you want to proceed |
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.
Which issue does this PR close?
SerializedPageReaderallocatesuncompressed_page_sizebytes before validating it against the column chunk #10734.Rationale for this change
SerializedPageReadervalidates a page's compressed size against the bytes remaining in its column chunk, but previously only checked thatuncompressed_page_sizewas non-negative.decode_pagethen used that untrusted value as aVeccapacity before decompression could detect a mismatch.Parquet's column metadata already supplies a structural bound: one page's uncompressed payload cannot exceed the column chunk's total uncompressed size, which includes every page and its header. Checking that invariant before decode rejects an inconsistent file without introducing a configurable limit for valid large pages.
What changes are included in this PR?
SerializedPageReader.Are these changes tested?
Yes. The regression constructs a tiny invalid Snappy page and verifies that both reader paths return
Invalid page headerbefore decompression. The compressed payload is intentionally invalid, so reaching the codec would produce a different error.Commands run:
cargo test -p parquetcargo clippy -p parquet --all-targets --all-features -- -D warningscargo +stable fmt --all -- --checkgit diff --checkAre there any user-facing changes?
Malformed Parquet files whose page uncompressed size exceeds their column chunk total now return an error before allocating a decompression buffer. There is no public API change.
AI usage
Codex assisted with tracing the reader paths, constructing the regression test, and drafting the change. I reviewed the Parquet metadata invariant, inspected every changed line, ran the checks above, and can debug and own the final patch.