Skip to content

Commit 8dd5eaa

Browse files
authored
Update builder.cc
1 parent b002e0b commit 8dd5eaa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cpp/src/arrow/builder.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,11 @@ Status BinaryBuilder::Resize(int64_t capacity) {
12271227
}
12281228

12291229
Status BinaryBuilder::ReserveData(int64_t capacity) {
1230-
DCHECK_LT(capacity, std::numeric_limits<int32_t>::max());
1231-
return value_data_builder_.Resize(capacity * sizeof(int64_t));
1230+
if(value_data_length.length() + capacity > std::numeric_limits<int32_t>::max()) {
1231+
return Status::Invalid("Cannot reserve capacity larger than 2^31 - 1 in length for binary data");
1232+
}
1233+
1234+
return value_data_builder_.Resize(value_data_length.length() + capacity);
12321235
}
12331236

12341237
Status BinaryBuilder::AppendNextOffset() {

0 commit comments

Comments
 (0)