From 2c7e74245a3ec2cc0df4651a94d9de9ad7d99919 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 11 Aug 2019 00:24:41 +0200 Subject: [PATCH] oss-fuzz/tiff_read_rgba_fuzzer.cc: avoid issue with libjpeg-turbo and MSAN --- contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc b/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc index b1b189f8..86137e2a 100644 --- a/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc +++ b/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc @@ -22,6 +22,7 @@ */ #include +#include #include #include #include @@ -40,6 +41,14 @@ extern "C" void handle_error(const char *unused, const char *unused2, va_list un extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { TIFFSetErrorHandler(handle_error); TIFFSetWarningHandler(handle_error); +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) + // libjpeg-turbo has issues with MSAN and SIMD code + // See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7547 + // and https://github.com/libjpeg-turbo/libjpeg-turbo/pull/365 + setenv("JSIMD_FORCENONE" ,"YES", 1); +# endif +#endif std::istringstream s(std::string(Data,Data+Size)); TIFF* tif = TIFFStreamOpen("MemTIFF", &s); if (!tif) {