]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/fuzzing: Support an oss-fuzz build with either address or undefined behaviour...
authorAndrew Bartlett <abartlet@samba.org>
Sat, 7 Dec 2019 00:01:58 +0000 (13:01 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 10 Dec 2019 07:50:29 +0000 (07:50 +0000)
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 <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/fuzzing/oss-fuzz/build_samba.sh

index 150abb7859187d1a715b732f3e94418e9013d1ae..f76955aeb7397452b1f55bfcc933e1b1100bb3a0 100755 (executable)
@@ -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" \