Skip to content

Commit

Permalink
ARROW-17964: [C++] Range data comparison for struct type may go out o…
Browse files Browse the repository at this point in the history
…f bounds
  • Loading branch information
rtpsw committed Oct 7, 2022
1 parent 45a008d commit d4190cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cpp/src/arrow/compare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ class RangeDataEqualsImpl {
Status Visit(const StructType& type) {
const int32_t num_fields = type.num_fields();

if (left_.child_data.size() != static_cast<size_t>(num_fields) ||
right_.child_data.size() != static_cast<size_t>(num_fields)) {
result_ = false;
return Status::OK();
}
auto compare_runs = [&](int64_t i, int64_t length) -> bool {
for (int32_t f = 0; f < num_fields; ++f) {
RangeDataEqualsImpl impl(options_, floating_approximate_, *left_.child_data[f],
Expand Down

0 comments on commit d4190cc

Please sign in to comment.