Out-of-bounds read for corrupt view offsets in BaseVariableWidthViewVector
- 主要言語
- Java
- スター
- 94
- フォーク
- 152
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 11
説明
### 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
コントリビューションガイド
調査の方向性
BaseVariableWidthViewVector から開始し、getData、getDataPointer、hashCode、copyFromNotNull、splitAndTransferViewBufferAndDataBuffer における out-of-line view の処理を調査します。リンクされた pull request と比較し、unsafe memory access を有効にした場合も含めて、破損した buffer index や offset/length の範囲によって範囲外読み取りが発生しなくなっていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100