Out-of-bounds read for corrupt view offsets in BaseVariableWidthViewVector
- Lingua principale
- Java
- Stelle
- 94
- Fork
- 152
- Merge medio
- 3g 16h
- PR unite (30g)
- 11
Descrizione
### Describe the bug
`ViewVarCharVector`/`ViewVarBinaryVector` store values longer than `INLINE_SIZE` (12 bytes) out of line, encoding a data-buffer index and an offset inline in the view buffer. When a vector is loaded from an IPC stream these fields come straight from the input.
`BaseVariableWidthViewVector` dereferences them verbatim in `getData`, `getDataPointer`, `hashCode`, `copyFromNotNull` and `splitAndTransferViewBufferAndDataBuffer`, e.g.
```java
dataBuffers.get(bufferIndex).getBytes(dataOffset, result, 0, dataLength);
```
Nothing checks that `bufferIndex` is in range or that `dataOffset + dataLength` fits inside the referenced data buffer. A crafted view whose offset/length points past the data buffer produces an out-of-bounds read: with the default bounds checking it throws `IndexOutOfBoundsException`, but with `arrow.enable_unsafe_memory_access=true` (commonly set in production) it reads arbitrary native heap into the returned value.
### Component(s)
Java
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia in BaseVariableWidthViewVector e analizza la gestione delle view out-of-line in getData, getDataPointer, hashCode, copyFromNotNull e splitAndTransferViewBufferAndDataBuffer. Confronta la pull request collegata, quindi verifica che gli indici del buffer corrotti e gli intervalli di offset/length non consentano più letture fuori dai limiti, anche con l’accesso alla memoria unsafe abilitato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 25/100