mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Fix fuzz tests to work on oss-fuzz
- the tests now build/run/check_build with libfuzzer on oss-fuzz - centipede is removed as it builds/runs but do not check_build (timeout due to arguments not parsed correctly) Bug: oss-fuzz:69508 Change-Id: Id063565fc4cce02fc5e36c7d8499d6de9ff54345
This commit is contained in:
@ -39,21 +39,27 @@
|
||||
set -eu
|
||||
|
||||
# Avoid fuzz engines that do not compile.
|
||||
if [[ "$FUZZING_ENGINE" != "libfuzzer" && "$FUZZING_ENGINE" != "centipede" ]]; then
|
||||
if [[ "$FUZZING_ENGINE" != "libfuzzer" ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
EXTRA_CMAKE_FLAGS=""
|
||||
if [ "$FUZZING_ENGINE" == "libfuzzer" ]
|
||||
then
|
||||
export CXXFLAGS="${CXXFLAGS} -DFUZZTEST_COMPATIBILITY_MODE"
|
||||
EXTRA_CMAKE_FLAGS="-DFUZZTEST_COMPATIBILITY_MODE=libfuzzer"
|
||||
fi
|
||||
|
||||
# limit allocation size to reduce spurious OOMs
|
||||
WEBP_CFLAGS="$CFLAGS -DWEBP_MAX_IMAGE_SIZE=838860800" # 800MiB
|
||||
|
||||
export CFLAGS="$WEBP_CFLAGS"
|
||||
cmake -S . -B build -DWEBP_BUILD_FUZZTEST=ON
|
||||
cmake -S . -B build -DWEBP_BUILD_FUZZTEST=ON ${EXTRA_CMAKE_FLAGS}
|
||||
cd build && make -j$(nproc) && cd ..
|
||||
|
||||
find $SRC/libwebp-test-data -type f -size -32k -iname "*.webp" \
|
||||
-exec zip -qju fuzz_seed_corpus.zip "{}" \;
|
||||
|
||||
# build fuzztests
|
||||
# The following is taken from https://github.com/google/oss-fuzz/blob/31ac7244748ea7390015455fb034b1f4eda039d9/infra/base-images/base-builder/compile_fuzztests.sh#L59
|
||||
# Iterate the fuzz binaries and list each fuzz entrypoint in the binary. For
|
||||
# each entrypoint create a wrapper script that calls into the binaries the
|
||||
|
Reference in New Issue
Block a user