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

Aperta
#12,473 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@viirya ci sta già lavorando.

Dal 26/11/2026.

  • #12474 di @viirya — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
databases

Direzione di ricerca

Start with BitReader::get_vlq_int in parquet/src/util/bit_util.rs and compare its limits with arrow-avro/src/reader/vlq.rs; then inspect the RLE and DELTA_BINARY_PACKED callers named in the report. Add coverage for overlong encodings and a 10th byte with bits beyond bit 63, and confirm malformed page data returns a ParquetError. Pull request #12474 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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.

Lingua principale
Rust
Stelle
3.7k
Fork
1.5k
Merge medio
2g 16h
PR unite (30g)
183

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/arrow-rs

Tutte le issue di apache/arrow-rs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.