arrow-cpp: fix for zstd 1.3.6+ (#48928)

This commit is contained in:
Dmitry Kalinkin 2018-10-24 04:50:01 -04:00 committed by xeji
parent 53715963be
commit c88e09d46f
2 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,9 @@ stdenv.mkDerivation rec {
# patch to fix python-test # patch to fix python-test
./darwin.patch ./darwin.patch
# facebook/zstd#1385
./zstd136.patch
]; ];
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];

View File

@ -0,0 +1,17 @@
--- 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.");