Skip to content

Commit

Permalink
apacheGH-41317: [C++] Fix crash on invalid Parquet file
Browse files Browse the repository at this point in the history
Lead-authored-by: mwish <maplewish117@gmail.com>
  • Loading branch information
rouault committed Apr 24, 2024
1 parent 16e20b7 commit 0a134e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cpp/src/parquet/arrow/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,16 @@ Status FileReaderImpl::GetRecordBatchReader(const std::vector<int>& row_groups,
}
}

// Check all columns has same row-size
if (!columns.empty()) {
int64_t row_size = columns[0]->length();
for (size_t i = 1; i < columns.size(); ++i) {
if (columns[i]->length() != row_size) {
return ::arrow::Status::Invalid("columns do not have the same size");
}
}
}

auto table = ::arrow::Table::Make(batch_schema, std::move(columns));
auto table_reader = std::make_shared<::arrow::TableBatchReader>(*table);

Expand Down

0 comments on commit 0a134e3

Please sign in to comment.