summaryrefslogtreecommitdiffstats
path: root/security/nss/coreconf/fuzz.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /security/nss/coreconf/fuzz.sh
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'security/nss/coreconf/fuzz.sh')
-rw-r--r--security/nss/coreconf/fuzz.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/security/nss/coreconf/fuzz.sh b/security/nss/coreconf/fuzz.sh
new file mode 100644
index 0000000000..da6000cbee
--- /dev/null
+++ b/security/nss/coreconf/fuzz.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+# This file is used by build.sh to setup fuzzing.
+
+set +e
+
+# Default to clang if CC is not set.
+if [ -z "$CC" ]; then
+ if ! command -v clang &> /dev/null 2>&1; then
+ echo "Fuzzing requires clang!"
+ exit 1
+ fi
+ export CC=clang
+ export CCC=clang++
+ export CXX=clang++
+fi
+
+gyp_params+=(-Dstatic_libs=1 -Dfuzz=1 -Dsign_libs=0)
+
+# Add debug symbols even for opt builds.
+nspr_params+=(--enable-debug-symbols)
+
+if [ "$fuzz_oss" = 1 ]; then
+ gyp_params+=(-Dno_zdefs=1 -Dfuzz_oss=1)
+else
+ enable_sanitizer asan
+ # Ubsan only builds on x64 for the moment.
+ if [ "$target_arch" = "x64" ]; then
+ enable_ubsan
+ fi
+ enable_sancov
+fi
+
+if [ "$fuzz_tls" = 1 ]; then
+ gyp_params+=(-Dfuzz_tls=1)
+fi
+
+if [ ! -f "/usr/lib/libFuzzingEngine.a" ]; then
+ echo "Cloning libFuzzer files ..."
+ run_verbose "$cwd"/fuzz/config/clone_libfuzzer.sh
+fi