Repository navigation
fix(parquet): return error for invalid DELTA_LENGTH_BYTE_ARRAY lengths - #12324
Merged
etseidl merged 3 commits intoNov 19, 2026
Merged
Conversation
DeltaLengthByteArrayDecoder::set_data did not validate the decoded lengths. A negative length or lengths summing past the end of the page made get and skip panic. Reject both when the page is set, as the arrow reader decoders already do. DeltaByteArrayDecoder uses the same decoder for its suffixes and is fixed by the same check.
etseidl
approved these changes
Nov 18, 2026
etseidl
left a comment
Contributor
There was a problem hiding this comment.
Thanks @shashank11yadav, this looks correct to me. Might be worth mentioning in skip() that the next_offset sum is safe due to the validation in set_data coupled with other checks on the total buffer length.
Contributor
Author
Thanks for the review. I added a one-line comment in |
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?
Rationale for this change
A Parquet page encoded with DELTA_LENGTH_BYTE_ARRAY (including the suffix stream of DELTA_BYTE_ARRAY) whose lengths are negative, or add up to more bytes than the page holds, makes the reader panic instead of returning an error. A negative length gives an out-of-range offset in
get, and a length past the end panics inBytes::slice. Malformed input should return a ParquetError.What changes are included in this PR?
DeltaLengthByteArrayDecoder::set_datainparquet/src/encodings/decoding.rsnow checks the decoded lengths when the page is set. A negative length, a sum that overflows, or a sum greater than the data after the length stream returns an error.DeltaByteArrayDecoderuses the same decoder for its suffixes, so it gets the same check.mod testscover a negative length, a length past the end of the data, and a negative suffix length.getandskipare unchanged. The checks inset_datamake their offsets valid.Are these changes tested?
The three new tests fail without this change and pass with it. The decoding module tests, clippy with warnings denied, the rustfmt check, and the arrow-feature type check all passed on this commit.
Not run: the typos spell check, and the full parquet test suite. Only the decoding module tests were run.
Are there any significant user-facing changes?
No public API change. Malformed pages that used to panic now return a ParquetError.
AI usage disclosure
I used an AI coding assistant while preparing this change; I reviewed and tested all of it myself.