DictionaryEncoder.decode accepts out-of-range dictionary indices
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start at DictionaryEncoder.retrieveIndexVector and trace its use from DictionaryEncoder.decode, ListSubfieldEncoder.decodeListSubField, and StructSubfieldEncoder.decode. Verify that negative indices and indices equal to dictionaryCount are rejected before transfer.copyValueSafe; done means crafted dictionary indices cannot reach the dictionary copy with an invalid position.
Written by the indexing model from the issue text.
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.
- Dominant language
- Java
- Stars
- 95
- Forks
- 154
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/arrow-java
-
Type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/arrow-java#1300 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/arrow-java#1236 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/arrow-java#1230 ·
-
Type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
apache/arrow-java#1205 ·
-
Type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
apache/arrow-java#1196 · 1 comment ·
All issues in apache/arrow-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100