apache / apache/arrow-java

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

Ouverte
#1,217 0 commentaires 0 réactions 0 personnes assignées Réclamée par @lidavidm Voir sur GitHub
Langage dominant
Java
Étoiles
94
Forks
152
Merge moyen
3 j 16 h
PR mergées (30 j)
11

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans BaseVariableWidthViewVector et examinez la gestion des vues out-of-line dans getData, getDataPointer, hashCode, copyFromNotNull et splitAndTransferViewBufferAndDataBuffer. Comparez la pull request liée, puis vérifiez que les index de buffer corrompus et les plages d’offset/length ne permettent plus de lectures hors limites, y compris lorsque l’accès mémoire unsafe est activé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
security
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.