Skip to content

Parquet reader panics on overlong VLQ integers in RLE / DELTA_BINARY_PACKED page data #12473

Done

Description

@viirya

Describe the bug

BitReader::get_vlq_int (parquet/src/util/bit_util.rs) decodes ULEB128 integers that are read straight from page data: RLE/bit-packed hybrid run headers (RleDecoder::reload) and the DELTA_BINARY_PACKED page and block headers (block_size, mini_blocks_per_block, values_left, first_value, min_delta).

On malformed input it panics instead of returning a ParquetError:

  • With more than MAX_VLQ_BYTE_LEN (10) continuation bytes, release builds hit assert!(shift <= MAX_VLQ_BYTE_LEN * 7, "Num of bytes exceed MAX_VLQ_BYTE_LEN (10)").
  • Debug builds panic earlier, with a shift overflow on << 70.
  • A 10th byte carrying bits beyond bit 63 is silently truncated, so the decoder continues with a wrong value.

A corrupt or malicious Parquet file can therefore crash the reader.

To Reproduce

let mut data = vec![0xFF; 11];
data.push(0x01);
let mut decoder = RleDecoder::new(3);
decoder.set_data(data.into()); // panics

The same happens with DeltaBitPackDecoder::set_data when the header starts with 11 or more bytes that have the high bit set.

Expected behavior

The reader returns an error, as it does for other corrupt page data.

Additional context

The thrift compact protocol's read_vlq (parquet/src/parquet_thrift.rs) uses wrapping_shl, so it doesn't panic, but an overlong varint in the metadata silently decodes to a wrong value.

arrow-avro's read_varint (arrow-avro/src/reader/vlq.rs) already applies the right limits: at most 10 bytes, and the 10th byte must be < 2.

Found while discussing #12467.

Activity

  1. added
    bug
    on Nov 26, 2026
  2. added a commit that references this issue on Dec 3, 2026
    50b25a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions