apache / apache/arrow-java

Out-of-bounds read for corrupt view offsets in BaseVariableWidthViewVector

Abierto
#1,217 0 comentarios 0 reacciones 0 asignados Reclamado por @lidavidm Ver en GitHub
Lenguaje dominante
Java
Estrellas
94
Forks
152
Merge medio
3 d 16 h
PR fusionados (30 d)
11

Descripción

### 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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en BaseVariableWidthViewVector e inspecciona el manejo de vistas out-of-line en getData, getDataPointer, hashCode, copyFromNotNull y splitAndTransferViewBufferAndDataBuffer. Compara el pull request enlazado y, a continuación, verifica que los índices de buffer corruptos y los rangos de offset/length ya no permitan lecturas fuera de los límites, incluso con el acceso a memoria unsafe habilitado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
security
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.