Repository navigation
fix(parquet): prevent byte stream split decoder panic - #11136
jaideeppyne wants to merge 8 commits into
Conversation
…_values Reject BYTE_STREAM_SPLIT buffers shorter than num_values * type size instead of decoding the encoded count. Exact-size input still decodes, and oversized buffers keep the existing error. V1 pages have no non-null count, so the column reader passes the number of complete values in the buffer and leaves nulls to definition levels.
|
@jaideeppyne could you enable the CI on your fork |
…-stream-split-value-count
|
Fork Actions are enabled, and the PR branch includes current Fork verification: full CI run for head |
alamb
left a comment
There was a problem hiding this comment.
Where was the panic that was removed?
How would someone reach this for real?
|
Going to mark this draft as it's waiting on submitter input |
|
@alamb, the panic is at Here are actual files and a runnable public-API program: The writer creates eight doubles and the control reads all eight back. Only zero-based byte 14 changes, from 16 to 126, declaring 63 values while the payload and footer stay in place. Verification observed The update also follows @jhorstmann's suggestion: both decoder variants use the encoded count, and the column-reader workaround is removed. The new integration test exercises this file-construction path directly. Focused tests, Clippy, and formatting passed; full fork CI for the published head also passed, including the workspace and cross-language integration tests. macOS, Windows, and documentation deployment were skipped by that workflow. This follow-up and its reproducer were prepared with OpenAI Codex assistance. |
…alues Read the 487 byte reproducer from a checked-in fixture instead of rewriting a page header in the test. Both BYTE_STREAM_SPLIT decoders now error when the page holds more encoded values than the page's value count allows. That count is an upper bound (it includes nulls for V1 pages), so fewer encoded values remain valid and the stride is still derived from the encoded length. Drop the column reader unit test: nullable V1 pages are already covered end to end by existing reader and writer tests.
|
@alamb thanks for the review. 0e75fbd addresses all four comments, with replies inline:
The branch also merges current |
alamb
left a comment
There was a problem hiding this comment.
looks good @jaideeppyne -- I have a few more questions but this is looking very close
Closes #11121.
BYTE_STREAM_SPLIT must bound decoding by the complete values present in its byte streams. A page count can include nulls or be corrupt; trusting it as the buffer bound lets
join_streams_constindex past the encoded data.Both fixed- and variable-width decoders now derive their value count from the encoded byte length, while retaining partial-value validation. Higher-level readers report insufficient values for a truncated required page. Valid nullable pages need no column-reader special case.
The regression writes a real Parquet file, verifies its eight original values, and changes one page-header byte to declare 63 values. On unchanged upstream this panics; with this fix it returns an ordinary error.
Reproducer: malformed file, 487 bytes, valid control, standalone public-API program.
Focused verification: the baseline panic and fixed error were observed with byte-identical fixtures; 1,505 Parquet unit tests and 147 Arrow-reader tests passed (one existing ignored test in each suite), along with all-target/all-feature Parquet Clippy and formatting. Decoder tests cover oversized count estimates, partial reads, skipping, and both variable-width join paths.
Full fork CI for the published head passed, including the Arrow workspace and Parquet tests, Clippy, MSRV, wasm builds, and cross-language Archery/PyArrow/PySpark checks. The workflow skipped macOS, Windows, and documentation deployment on this run.
AI disclosure: OpenAI Codex assisted with the implementation, regression tests, standalone reproducer, and verification analysis.