Skip to content

Commit 08f5304

Browse files
pitrouraulcd
authored andcommitted
GH-47803: [C++][Parquet] Fix read out of bounds on invalid RLE data (#47804)
Found by OSS-Fuzz, should fix https://issues.oss-fuzz.com/issues/451150486. Ensure RLE run is within bounds before reading it. Yes, by fuzz regression test in ASAN/UBSAN build. No. **This PR contains a "Critical Fix".** (If the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld), please provide explanation. If not, you can remove this.) * GitHub Issue: #47803 Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent d5b8e2b commit 08f5304

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cpp/src/arrow/util/rle_encoding_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,11 @@ auto RleBitPackedParser::PeekImpl(Handler&& handler) const
699699
ARROW_DCHECK_LT(value_bytes, internal::max_size_for_v<rle_size_t>);
700700
const auto bytes_read = header_bytes + static_cast<rle_size_t>(value_bytes);
701701

702+
if (ARROW_PREDICT_FALSE(bytes_read > data_size_)) {
703+
// RLE run would overflow data buffer
704+
return {0, ControlFlow::Break};
705+
}
706+
702707
auto control =
703708
handler.OnRleRun(RleRun(data_ + header_bytes, values_count, value_bit_width_));
704709

testing

Submodule testing updated 98 files

0 commit comments

Comments
 (0)