Skip to content

Commit d57a53b

Browse files
committed
Fix UB
1 parent f1e7830 commit d57a53b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cpp/src/arrow/util/bpacking_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ std::vector<uint8_t> GenerateRandomPackedValues(int32_t num_values, int32_t bit_
5252
constexpr uint32_t kSeed = 3214;
5353
EXPECT_OK_AND_ASSIGN(const auto num_bytes, GetNumBytes(num_values, bit_width));
5454

55-
std::vector<uint8_t> out(num_bytes);
55+
std::vector<uint8_t> out(std::max(1, num_bytes)); // We need a valid pointer for size 0
5656
random_bytes(num_bytes, kSeed, out.data());
5757

5858
return out;

0 commit comments

Comments
 (0)