18 lines
815 B
Diff
18 lines
815 B
Diff
|
--- a/src/arrow/util/compression_zstd.cc
|
||
|
+++ b/src/arrow/util/compression_zstd.cc
|
||
|
@@ -35,8 +35,13 @@ namespace util {
|
||
|
|
||
|
Status ZSTDCodec::Decompress(int64_t input_len, const uint8_t* input, int64_t output_len,
|
||
|
uint8_t* output_buffer) {
|
||
|
+ void *safe_output_buffer = static_cast<void*>(output_buffer);
|
||
|
+ int dummy {};
|
||
|
+ if ((output_len == 0) && (output_buffer == NULL)) {
|
||
|
+ safe_output_buffer = static_cast<void*>(&dummy);
|
||
|
+ }
|
||
|
int64_t decompressed_size =
|
||
|
- ZSTD_decompress(output_buffer, static_cast<size_t>(output_len), input,
|
||
|
+ ZSTD_decompress(safe_output_buffer, static_cast<size_t>(output_len), input,
|
||
|
static_cast<size_t>(input_len));
|
||
|
if (decompressed_size != output_len) {
|
||
|
return Status::IOError("Corrupt ZSTD compressed data.");
|