DictionaryEncoder.decode accepts out-of-range dictionary indices
- 主要言語
- Java
- スター
- 94
- フォーク
- 152
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 11
説明
`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`.
コントリビューションガイド
調査の方向性
DictionaryEncoder.retrieveIndexVector から開始し、DictionaryEncoder.decode、ListSubfieldEncoder.decodeListSubField、StructSubfieldEncoder.decode からの使用箇所を追跡します。負のインデックスと dictionaryCount に等しいインデックスが transfer.copyValueSafe の前に拒否されることを確認します。作成した辞書インデックスが無効な位置で辞書コピーに到達できなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- security
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 活発
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 74/100