DictionaryEncoder.decode accepts out-of-range dictionary indices
- Vorherrschende Sprache
- Java
- Sterne
- 94
- Forks
- 152
- Ø Merge
- 3 T. 16 Std.
- Gemergte PRs (30 T.)
- 11
Beschreibung
`DictionaryEncoder.retrieveIndexVector` guards each index from the index vector with `indexAsInt > dictionaryCount` before `transfer.copyValueSafe(indexAsInt, i)`. Valid indices are `0..dictionaryCount-1`, so the check is off by one: an index equal to `dictionaryCount` is accepted and reads one slot past the dictionary vector, and a negative index (a signed index type with the high bit set) is not rejected either and also reaches `copyValueSafe`. The index vector is decoded from an IPC/C-data payload, so a crafted dictionary-encoded batch yields an out-of-bounds read of the dictionary vector, exposing adjacent off-heap memory when bounds checking is disabled via `arrow.enable_unsafe_memory_access`.
The same helper backs `DictionaryEncoder.decode`, `ListSubfieldEncoder.decodeListSubField` and `StructSubfieldEncoder.decode`.
The bound should be `indexAsInt < 0 || indexAsInt >= dictionaryCount`.
Beitragsleitfaden
Rechercherichtung
Beginne bei DictionaryEncoder.retrieveIndexVector und verfolge seine Verwendung von DictionaryEncoder.decode, ListSubfieldEncoder.decodeListSubField und StructSubfieldEncoder.decode aus. Überprüfe, dass negative Indizes und Indizes, die dictionaryCount entsprechen, vor transfer.copyValueSafe abgewiesen werden; als erledigt gilt dies, wenn gezielt erstellte Dictionary-Indizes die Dictionary-Kopie nicht mit einer ungültigen Position erreichen können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- security
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Aktiv
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 74/100