From 4b1f7fa4fe6db31517075d7f20d6975452acfa85 Mon Sep 17 00:00:00 2001 From: tc-agent <270634894+tc-agent@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:38:48 +0000 Subject: [PATCH] fuzzing: make ossfuzz.sh resilient to individual compile failures Clang 22 (used by OSS-Fuzz since ~Dec 2025) has a compiler bug that segfaults when instantiating templates for msgpack_roundtrip_string.cpp. The set -e in ossfuzz.sh caused the entire build to abort on this single failure, leaving all other working fuzzers unbuilt. Remove -e from set -eux and wrap each compile in an if/else block so that a single compilation failure is logged as a warning but does not abort the build. Add a final check that exits non-zero only if zero fuzzers were built, preserving the invariant that a completely broken build is still an error. This unblocks the OSS-Fuzz build, which has been failing since 2025-12-18 (last successful build ID: 51ac6718-86c6-44f0-93c3-700557ee939c). --- fuzzing/ossfuzz.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fuzzing/ossfuzz.sh b/fuzzing/ossfuzz.sh index 8521e87b..d17eb03a 100755 --- a/fuzzing/ossfuzz.sh +++ b/fuzzing/ossfuzz.sh @@ -4,13 +4,23 @@ # build the fuzzers does not require changes in oss fuzz but instead can # be done in the glaze repository. -set -eux +set -ux $CXX --version +BUILT=0 for SRCFILE in $(ls fuzzing/*.cpp |grep -v -E '(exhaustive|main\.cpp)'); do NAME=$(basename $SRCFILE .cpp) - $CXX $CXXFLAGS -std=c++23 -g -Iinclude \ + if $CXX $CXXFLAGS -std=c++23 -g -Iinclude \ $SRCFILE -o $OUT/$NAME \ - $LIB_FUZZING_ENGINE + $LIB_FUZZING_ENGINE; then + BUILT=$((BUILT + 1)) + else + echo "WARNING: failed to build $NAME, skipping" >&2 + fi done + +if [ "$BUILT" -eq 0 ]; then + echo "ERROR: no fuzzers built" >&2 + exit 1 +fi