From: Andrew Bartlett Date: Sat, 7 Dec 2019 00:01:58 +0000 (+1300) Subject: lib/fuzzing: Support an oss-fuzz build with either address or undefined behaviour... X-Git-Tag: ldb-2.1.0~314 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5bb9ecdf15febb492bf9b65f5811ca0b59fefec8;p=thirdparty%2Fsamba.git lib/fuzzing: Support an oss-fuzz build with either address or undefined behaviour sanitizers Add handler for $SANITIZER in build.sh This allows a build with the undefined behaviour sanitizer. Otherwise we fail the oss-fuzz CI because the UBSan build links with ASan. Once this in in then https://github.com/google/oss-fuzz/pull/3094 can be merged to oss-fuzz. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh index 150abb78591..f76955aeb73 100755 --- a/lib/fuzzing/oss-fuzz/build_samba.sh +++ b/lib/fuzzing/oss-fuzz/build_samba.sh @@ -18,11 +18,27 @@ export CFLAGS LD="$CXX" export LD +# $SANITIZER is provided by the oss-fuzz "compile" command +# +# We need to add the waf configure option as otherwise when we also +# get (eg) -fsanitize=address via the CFLAGS we will fail to link +# correctly + +case "$SANITIZER" in + address) + SANITIZER_ARG='--address-sanitizer' + ;; + undefined) + SANITIZER_ARG='--undefined-sanitizer' + ;; +esac + # $LIB_FUZZING_ENGINE is provided by the oss-fuzz "compile" command # ./configure -C --without-gettext --enable-debug --enable-developer \ - --address-sanitizer --enable-libfuzzer \ + --enable-libfuzzer \ + $SANITIZER_ARG \ --disable-warnings-as-errors \ --abi-check-disable \ --fuzz-target-ldflags="$LIB_FUZZING_ENGINE" \