diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix index 77ce77dee5ad..96259dc66948 100644 --- a/pkgs/development/libraries/arrow-cpp/default.nix +++ b/pkgs/development/libraries/arrow-cpp/default.nix @@ -26,6 +26,9 @@ stdenv.mkDerivation rec { # patch to fix python-test ./darwin.patch + + # facebook/zstd#1385 + ./zstd136.patch ]; nativeBuildInputs = [ cmake ]; diff --git a/pkgs/development/libraries/arrow-cpp/zstd136.patch b/pkgs/development/libraries/arrow-cpp/zstd136.patch new file mode 100644 index 000000000000..1bdeecaef990 --- /dev/null +++ b/pkgs/development/libraries/arrow-cpp/zstd136.patch @@ -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(output_buffer); ++ int dummy {}; ++ if ((output_len == 0) && (output_buffer == NULL)) { ++ safe_output_buffer = static_cast(&dummy); ++ } + int64_t decompressed_size = +- ZSTD_decompress(output_buffer, static_cast(output_len), input, ++ ZSTD_decompress(safe_output_buffer, static_cast(output_len), input, + static_cast(input_len)); + if (decompressed_size != output_len) { + return Status::IOError("Corrupt ZSTD compressed data.");