diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
commit | 378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch) | |
tree | 44dfb6ca500d32cabd450649b322a42e70a30683 /tools/oss-fuzz.sh | |
parent | Initial commit. (diff) | |
download | util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip |
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/oss-fuzz.sh')
-rwxr-xr-x | tools/oss-fuzz.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh new file mode 100755 index 0000000..588d4aa --- /dev/null +++ b/tools/oss-fuzz.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -ex + +export LC_CTYPE=C.UTF-8 + +export CC=${CC:-clang} +export CXX=${CXX:-clang++} +export LIB_FUZZING_ENGINE=${LIB_FUZZING_ENGINE:--fsanitize=fuzzer} + +SANITIZER=${SANITIZER:-address -fsanitize-address-use-after-scope} +flags="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=$SANITIZER -fsanitize=fuzzer-no-link" + +export CFLAGS=${CFLAGS:-$flags} +export CXXFLAGS=${CXXFLAGS:-$flags} + +export OUT=${OUT:-$(pwd)/out} +mkdir -p $OUT + +./autogen.sh +./configure --disable-all-programs --enable-libuuid --enable-libfdisk --enable-last --enable-fuzzing-engine --enable-libmount --enable-libblkid +make -j$(nproc) V=1 check-programs + +for d in "$(dirname $0)"/../tests/ts/fuzzers/test_*_fuzz_files; do + bd=$(basename "$d") + fuzzer=${bd%_files} + zip -jqr $OUT/${fuzzer}_seed_corpus.zip "$d" +done + +find . -maxdepth 1 -type f -executable -name "test_*_fuzz" -exec mv {} $OUT \; +find . -type f -name "fuzz-*.dict" -exec cp {} $OUT \; |