parquet: `DELTA_BYTE_ARRAY` and `DELTA_LENGTH_BYTE_ARRAY` decoders panic in `Bytes::slice` when the lengths block is cut short
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read the three unchecked slice sites named in parquet/src/arrow/decoder/delta_byte_array.rs and parquet/src/encodings/decoding.rs, then compare the bounds checks in byte_array.rs and byte_view_array.rs. Start by running the supplied reproducer; done means truncated input returns an error instead of panicking at all three decoder call sites.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
The byte array delta decoders decode the lengths with DeltaBitPackDecoder and then slice the page at get_offset() to find what follows. Once all values are read, get_offset() reports the end of the current block as its miniblock bit widths declare it. On a truncated or corrupt page that is past the end of the buffer, and Bytes::slice panics:
thread 'main' panicked at bytes-1.12.2/src/bytes.rs:374:28:
range start must not be greater than end: 51 <= 17
Three call sites slice without checking:
parquet/src/arrow/decoder/delta_byte_array.rs:32(Arrow reader)parquet/src/encodings/decoding.rs:979(DeltaLengthByteArrayDecoder)parquet/src/encodings/decoding.rs:1130(DeltaByteArrayDecoder)
Found by byte-flip fuzzing; one flipped byte in a DELTA_BYTE_ARRAY page of a zstd v2 file is enough.
To Reproduce
// parquet = { version = "60.2.0", features = ["experimental"] }
use bytes::Bytes;
use parquet::data_type::ByteArrayType;
use parquet::encodings::decoding::{Decoder, DeltaByteArrayDecoder};
fn main() {
// DELTA_BINARY_PACKED prefix lengths [0, 300, 0]: block size 128, 4 miniblocks,
// 3 values, first value 0, min delta -300, miniblock bit widths [10, 0, 0, 0].
// The miniblock should be 40 bytes (32 values of 10 bits); the page ends after 6.
let page = Bytes::from_static(&[128, 1, 4, 3, 0, 215, 4, 10, 0, 0, 0, 88, 2, 0, 0, 0, 0]);
let mut decoder = DeltaByteArrayDecoder::<ByteArrayType>::new();
println!("{:?}", decoder.set_data(page, 3));
}
Panics on 60.2.0 and on main (d470f2d54).
Expected behavior
An error, as for the other malformed length streams (#12290 / #12324).
Additional context
byte_array.rs and byte_view_array.rs already compare len_decoder.get_offset() with data.len() before using it.
This report was prepared with AI assistance (Claude Code). The reproduction was run against 60.2.0 and main.
Willingness to contribute
I plan to contribute a fix for this bug independently
- Lingua principale
- Rust
- Stelle
- 3.7k
- Fork
- 1.5k
- Merge medio
- 2g 16h
- PR unite (30g)
- 183
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/arrow-rs
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
`RunArray::try_new` rejects run ends whose null buffer has no nullsForse già presa @Surajsuthar l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/arrow-rs#12427 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Variant] `variant_get` string and binary cast errors show Rust builder type namesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/arrow-rs
Issue simili
-
area:ui effort:medium enhancement P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousApertamaintainer-needed p2 remote triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
userFRM/egui-charts#4605 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno