Merge pull request #24922 from Avogar/fix-arrow

Fix possible heap-buffer-overflow in Arrow
This commit is contained in:
Nikita Mikhaylov 2021-06-03 22:06:38 +03:00 committed by GitHub
commit 3b0757bb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,9 +90,12 @@ namespace DB
arrow::BinaryArray & chunk = static_cast<arrow::BinaryArray &>(*(arrow_column->chunk(chunk_i))); arrow::BinaryArray & chunk = static_cast<arrow::BinaryArray &>(*(arrow_column->chunk(chunk_i)));
const size_t chunk_length = chunk.length(); const size_t chunk_length = chunk.length();
if (chunk_length > 0)
{
chars_t_size += chunk.value_offset(chunk_length - 1) + chunk.value_length(chunk_length - 1); chars_t_size += chunk.value_offset(chunk_length - 1) + chunk.value_length(chunk_length - 1);
chars_t_size += chunk_length; /// additional space for null bytes chars_t_size += chunk_length; /// additional space for null bytes
} }
}
column_chars_t.reserve(chars_t_size); column_chars_t.reserve(chars_t_size);
column_offsets.reserve(arrow_column->length()); column_offsets.reserve(arrow_column->length());