]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - tools/oss-fuzz.sh
test-seccomp: minor simpification
[thirdparty/systemd.git] / tools / oss-fuzz.sh
index 6d9010ce16070d6935d5b2fbc513a24ec8d9e101..5b8690b687fe199d8e8dd121aab3f06129068f43 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1+
 
 set -ex
@@ -27,9 +27,15 @@ build=$WORK/build
 rm -rf $build
 mkdir -p $build
 
-fuzzflag="oss-fuzz=true"
 if [ -z "$FUZZING_ENGINE" ]; then
     fuzzflag="llvm-fuzz=true"
+else
+    fuzzflag="oss-fuzz=true"
+    if [[ "$SANITIZER" == undefined ]]; then
+        UBSAN_FLAGS="-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow"
+        CFLAGS="$CFLAGS $UBSAN_FLAGS"
+        CXXFLAGS="$CXXFLAGS $UBSAN_FLAGS"
+    fi
 fi
 
 meson $build -D$fuzzflag -Db_lundef=false
@@ -48,7 +54,6 @@ zip -jqr $OUT/fuzz-dns-packet_seed_corpus.zip $df/packet
 
 install -Dt $OUT/src/shared/ $build/src/shared/libsystemd-shared-*.so
 
-wget -O $OUT/fuzz-json_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/skjson_seed_corpus.zip
 wget -O $OUT/fuzz-json.dict https://raw.githubusercontent.com/rc0r/afl-fuzz/master/dictionaries/json.dict
 
 find $build -maxdepth 1 -type f -executable -name "fuzz-*" -exec mv {} $OUT \;