Skip to content

Commit 37e09a6

Browse files
committed
GH-47666: [C++][Parquet] Fix DeltaByteArrayDecoder to deal with corrupted input
1 parent 9b96bdb commit 37e09a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cpp/src/parquet/decoder.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ struct ArrowBinaryHelper<ByteArrayType, ArrowBinaryType> {
178178

179179
Status AppendValue(const uint8_t* data, int32_t length,
180180
std::optional<int64_t> estimated_remaining_data_length = {}) {
181+
if (ARROW_PREDICT_FALSE(data == nullptr)) {
182+
return Status::Invalid("data is nullptr");
183+
}
181184
if (!kIsBinaryView && estimated_remaining_data_length.has_value()) {
182185
// Assume Prepare() was already called with an estimated_data_length
183186
builder_->UnsafeAppend(data, length);
@@ -207,6 +210,9 @@ struct ArrowBinaryHelper<FLBAType, ::arrow::FixedSizeBinaryType> {
207210

208211
Status AppendValue(const uint8_t* data, int32_t length,
209212
std::optional<int64_t> estimated_remaining_data_length = {}) {
213+
if (ARROW_PREDICT_FALSE(data == nullptr)) {
214+
return Status::Invalid("data is nullptr");
215+
}
210216
acc_->UnsafeAppend(data);
211217
return Status::OK();
212218
}

0 commit comments

Comments
 (0)