apache / apache/arrow-java

DictionaryEncoder.decode accepts out-of-range dictionary indices

Ouverte Adaptée aux débutants
#1,261 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
94
Forks
152
Merge moyen
3 j 16 h
PR mergées (30 j)
11

Description

`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`.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par DictionaryEncoder.retrieveIndexVector et suivez son utilisation depuis DictionaryEncoder.decode, ListSubfieldEncoder.decodeListSubField et StructSubfieldEncoder.decode. Vérifiez que les indices négatifs et les indices égaux à dictionaryCount sont rejetés avant transfer.copyValueSafe ; c’est terminé lorsque des indices de dictionnaire forgés ne peuvent pas atteindre la copie du dictionnaire avec une position invalide.

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é
2/5
Temps estimé
1-3 heures
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
74/100

Recevez les nouvelles issues par e-mail

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