From 8bc3e510fcf8b4f225745cc245f0db3ae69a88b8 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Mon, 11 Apr 2022 00:23:02 +0000 Subject: [PATCH] ci: turn off _FORTIFY_SOURCE explicitly libelf is compiled with _FORTIFY_SOURCE by default and it isn't compatible with MSan. It was borrowed from https://github.com/google/oss-fuzz/pull/7422 --- scripts/build-fuzzers.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/build-fuzzers.sh b/scripts/build-fuzzers.sh index ba48ee8..75b3833 100755 --- a/scripts/build-fuzzers.sh +++ b/scripts/build-fuzzers.sh @@ -17,6 +17,14 @@ mkdir -p "$OUT" export LIB_FUZZING_ENGINE=${LIB_FUZZING_ENGINE:--fsanitize=fuzzer} +# libelf is compiled with _FORTIFY_SOURCE by default and it +# isn't compatible with MSan. It was borrowed +# from https://github.com/google/oss-fuzz/pull/7422 +if [[ "$SANITIZER" == memory ]]; then + CFLAGS+=" -U_FORTIFY_SOURCE" + CXXFLAGS+=" -U_FORTIFY_SOURCE" +fi + # The alignment check is turned off by default on OSS-Fuzz/CFLite so it should be # turned on explicitly there. It was borrowed from # https://github.com/google/oss-fuzz/pull/7092