Skip to content

Make fuzzing with meson build work

hansmi requested to merge hansmi/usbredir:mesonfuzz1 into master

TL;DR: Update build system and utility script such invoking build-aux/oss-fuzz.sh is all that's needed to build fuzzers in an OSS-Fuzz compatible environment.

.gitlab-ci.yml: Build three variants of fuzzers: using autoconf as before, libFuzzer via Clang and using the standalone driver.

build-aux/oss-fuzz.sh: Remove compiler-specific code. The fuzzing environment should control the compiler via $CC/$CXX along with flags in $CFLAGS/$CXXFLAGS. Make code actually build by overriding b_lundef default value, otherwise fuzzing-related symbols would cause linker errors during compilation. Pass fuzzing engine via option; the default would be to use the built-in standalone engine.

meson.build: Remove all fuzzing-related logic except to detect whether fuzzing should be enabled at all.

fuzzing/meson.build: If fuzzing engine standalone is selected the build behaves as any other C program build. When another fuzzing engine is to be used, e.g. from $LIB_FUZZING_ENGINE in build-aux/oss-fuzz.sh, a test program is compiled and linked to ensure that linking suceeds (in particular whether a main function is provided). Prepare for the addition of more fuzzing binaries by using a loop. Add OSS-Fuzz configuration file for binaries.

Edited by hansmi

Merge request reports

Loading