Out-of-bounds read for corrupt view offsets in BaseVariableWidthViewVector
- Linguagem predominante
- Java
- Estrelas
- 94
- Forks
- 152
- Merge médio
- 3d 16h
- PRs com merge (30d)
- 11
Descrição
### 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
Guia de contribuição
Direção de pesquisa
Comece em BaseVariableWidthViewVector e inspecione o tratamento de views out-of-line em getData, getDataPointer, hashCode, copyFromNotNull e splitAndTransferViewBufferAndDataBuffer. Compare o pull request vinculado e, em seguida, verifique se índices de buffer corrompidos e intervalos de offset/length não permitem mais leituras fora dos limites, inclusive com o acesso à memória unsafe habilitado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- java
- Domínio
- security
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 25/100