summaryrefslogtreecommitdiff
path: root/lib/fuzzing
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-11-20 14:03:13 +1300
committerDouglas Bagnall <dbagnall@samba.org>2019-11-20 23:19:35 +0000
commitf57c0238e91061698787e4a4b18fb549cc2c86f2 (patch)
tree20c4fa1d9b25dba1707da4ff792d59ee896716b2 /lib/fuzzing
parent92ee647858331db012db06314d98e08fe1e5eb5b (diff)
downloadsamba-f57c0238e91061698787e4a4b18fb549cc2c86f2.tar.gz
lib/fuzzing/oss-fuzz: Add build_samba.sh for oss-fuzz
We work hard to put the primary logic for oss-fuzz here, and where possible into waf, so that only a tiny stub needs to be maintained in the Google oss-fuzz repo. This will be called by build.sh (not copied directly because it is too easy to forget to copy in an updated version when doing development in the docker image). Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Uri Simchoni <uri@samba.org>
Diffstat (limited to 'lib/fuzzing')
-rwxr-xr-xlib/fuzzing/oss-fuzz/build_samba.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh
new file mode 100755
index 00000000000..e5d85f7ba34
--- /dev/null
+++ b/lib/fuzzing/oss-fuzz/build_samba.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+# We have to push to oss-fuzz CFLAGS into the waf ADDITIONAL_CFLAGS
+# as otherwise waf's configure fails linking the first test binary
+ADDITIONAL_CFLAGS=$CFLAGS
+export ADDITIONAL_CFLAGS
+CFLAGS=""
+export CFLAGS
+LD=$CXX
+export LD
+
+./configure -C --without-gettext --enable-debug --enable-developer \
+ --address-sanitizer --enable-libfuzzer \
+ --disable-warnings-as-errors \
+ --abi-check-disable \
+ --fuzz-target-ldflags=$LIB_FUZZING_ENGINE \
+ --nonshared-binary=ALL LINK_CC=$CXX
+
+make -j
+
+cp bin/fuzz_* $OUT/