DictionaryEncoder.decode accepts out-of-range dictionary indices
- Ngôn ngữ chính
- Java
- Star
- 94
- Fork
- 152
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
`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`.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại DictionaryEncoder.retrieveIndexVector và lần theo cách nó được sử dụng từ DictionaryEncoder.decode, ListSubfieldEncoder.decodeListSubField và StructSubfieldEncoder.decode. Xác minh rằng các chỉ mục âm và các chỉ mục bằng dictionaryCount bị từ chối trước transfer.copyValueSafe; được xem là hoàn thành khi các chỉ mục từ điển được tạo thủ công không thể đến được bản sao từ điển với một vị trí không hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- security
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 74/100