]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[build] Fix oss-fuzz build with the dataflow sanitizer 2799/head
authorNick Terrell <terrelln@fb.com>
Thu, 23 Sep 2021 18:48:39 +0000 (11:48 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 23 Sep 2021 18:48:39 +0000 (11:48 -0700)
The dataflow sanitizer requires all code to be instrumented. We can't
instrument the ASM function, so we have to disable it.

lib/common/compiler.h
lib/decompress/huf_decompress.c

index 9d7d968ce9b39a7b718fb3b214222a05797c7ebc..e5292d773c2f82438ebb65cf63723be76a7d39e1 100644 (file)
 #  endif
 #endif
 
+/* detects whether we are being compiled undef dfsan */
+#ifndef ZSTD_DATAFLOW_SANITIZER
+# if __has_feature(dataflow_sanitizer)
+#  define ZSTD_DATAFLOW_SANITIZER 1
+# else
+#  define ZSTD_DATAFLOW_SANITIZER 0
+# endif
+#endif
+
 #if ZSTD_MEMORY_SANITIZER
 /* Not all platforms that support msan provide sanitizers/msan_interface.h.
  * We therefore declare the functions we need ourselves, rather than trying to
index 2efca7dd534ae1cd5f82359183ca22dd96518a88..128b08019c480c536d717daf9b52f9e677c438db 100644 (file)
@@ -47,7 +47,7 @@
  * Disable when MSAN is enabled.
  */
 #if defined(__linux__) || defined(__linux) || defined(__APPLE__)
-# if ZSTD_MEMORY_SANITIZER
+# if ZSTD_MEMORY_SANITIZER || ZSTD_DATAFLOW_SANITIZER
 #  define HUF_ASM_SUPPORTED 0
 # else
 #  define HUF_ASM_SUPPORTED 1