mirror of
https://github.com/stefanberger/libtpms
synced 2025-08-24 17:39:47 +00:00

There were a few issues with the oss-fuzz integration from commit
8373f09854
("build-sys: add oss-fuzz
support").
When building on OSS-Fuzz, the projects should use the provided CFLAGS
and CXXFLAGS and don't append any extra sanitization / fuzzing flags.
$LIB_FUZZING_ENGINE is defined to set the library to link to, and it
is a c++ library, so we should build fuzzer with c++...
Now --enable-fuzzer is only used for -fsanitize=fuzzer.
Add a tests/fuzz-main.c as fallback, to run the corpus on other builds.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
27 lines
562 B
Bash
Executable File
27 lines
562 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
export CC=${CC:-clang}
|
|
export CXX=${CXX:-clang++}
|
|
export WORK=${WORK:-$(pwd)}
|
|
export OUT=${OUT:-$(pwd)/out}
|
|
|
|
mkdir -p $OUT
|
|
|
|
build=$WORK/build
|
|
rm -rf $build
|
|
mkdir -p $build
|
|
|
|
export LIBTPMS=$(pwd)
|
|
autoreconf -vfi
|
|
|
|
cd $build
|
|
$LIBTPMS/configure --disable-shared --enable-static --with-openssl --with-tpm2
|
|
make -j$(nproc) && make -C tests fuzz
|
|
|
|
zip -jqr $OUT/fuzz_seed_corpus.zip "$LIBTPMS/tests/corpus-execute-command"
|
|
|
|
find $build -type f -executable -name "fuzz*" -exec mv {} $OUT \;
|
|
find $build -type f -name "*.options" -exec mv {} $OUT \;
|