apache / apache/arrow-java

DictionaryEncoder.decode accepts out-of-range dictionary indices

Abierto Apto para principiantes
#1,261 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
94
Forks
152
Merge medio
3 d 16 h
PR fusionados (30 d)
11

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en DictionaryEncoder.retrieveIndexVector y sigue su uso desde DictionaryEncoder.decode, ListSubfieldEncoder.decodeListSubField y StructSubfieldEncoder.decode. Verifica que los índices negativos y los índices iguales a dictionaryCount se rechacen antes de transfer.copyValueSafe; se considera completado cuando los índices de diccionario diseñados no pueden llegar a la copia del diccionario con una posición no válida.

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
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
74/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.