Skip to content

fix(parquet): return error on negative DELTA_BYTE_ARRAY lengths in arrow decoder - #12108

Merged
Rich-T-kid merged 1 commit into
apache:mainfrom
hsdfat:fix-delta-byte-array-negative-length-12097
Nov 8, 2026
Merged

Rich-T-kid merged 1 commit into
apache:mainfrom
hsdfat:fix-delta-byte-array-negative-length-12097

Conversation

@hsdfat

@hsdfat hsdfat commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

The arrow DeltaByteArrayDecoder casts the page's i32 prefix and suffix lengths to usize without checking them. On a corrupt page a negative suffix length becomes a huge usize, data_offset + suffix_length wraps in release builds, the bounds check passes and the slice panics. #9796 fixed the same thing for the decoder in encodings/decoding.rs.

What changes are included in this PR?

  • DeltaByteArrayDecoder::new returns an error if any prefix or suffix length is negative.
  • read and skip compute the end offset with checked_add, so the bounds check can't wrap.

Are these changes tested?

Yes, two unit tests build pages with a negative prefix and a negative suffix length and check that new returns an error.

Are there any significant user-facing changes?

No. Corrupt pages that used to panic now return an error.


AI disclosure: the patch and tests were drafted with AI assistance (Claude); I reviewed every line and ran fmt, clippy and the parquet decoder tests.

…row decoder

Reject negative prefix and suffix lengths in DeltaByteArrayDecoder::new
and use an overflow-safe bounds check in read and skip, so corrupt pages
return an error instead of panicking.

Closes apache#12097
@github-actions github-actions Bot added the parquet parquet crate label Nov 6, 2026
@Rich-T-kid

Copy link
Copy Markdown
Contributor

thanks @hsdfat

@Rich-T-kid
Rich-T-kid added this pull request to the merge queue Nov 8, 2026
Merged via the queue into apache:main with commit 548c7bb Nov 8, 2026
23 checks passed
@Jefffrey Jefffrey added the bug Squash those bugs label Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Squash those bugs parquet parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parquet: arrow DeltaByteArrayDecoder panics on a negative suffix length instead of returning an error

3 participants