From d161682199adb83f43dc8d39b487a06aaf3fcc27 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 12 Dec 2025 13:52:55 +0000 Subject: [PATCH] Fuzzing: Move LPM build to oss-fuzz Dockerfile by default --- fuzzing/scripts/oss-fuzz-build.sh | 12 ------------ fuzzing/scripts/oss-fuzz-dependencies.sh | 14 +++++++++----- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/fuzzing/scripts/oss-fuzz-build.sh b/fuzzing/scripts/oss-fuzz-build.sh index 3f040d5b..adf61246 100755 --- a/fuzzing/scripts/oss-fuzz-build.sh +++ b/fuzzing/scripts/oss-fuzz-build.sh @@ -29,18 +29,6 @@ cmake \ make -j $(nproc) make install -cd ${SRC}/libprotobuf-mutator -cmake \ - -DCMAKE_C_COMPILER=clang \ - -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_BUILD_TYPE=Debug \ - -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON \ - -DLIB_PROTO_MUTATOR_EXAMPLES=OFF \ - -DLIB_PROTO_MUTATOR_TESTING=OFF \ - . -make -j $(nproc) -make install - # Build broker and library static libraries cd ${SRC}/mosquitto make \ diff --git a/fuzzing/scripts/oss-fuzz-dependencies.sh b/fuzzing/scripts/oss-fuzz-dependencies.sh index 2c8eb512..34e44d8f 100755 --- a/fuzzing/scripts/oss-fuzz-dependencies.sh +++ b/fuzzing/scripts/oss-fuzz-dependencies.sh @@ -34,9 +34,13 @@ apt-get update && apt-get install -y \ ninja-build \ pkg-config git clone https://github.com/ralight/cJSON ${SRC}/cJSON -git clone https://github.com/google/libprotobuf-mutator ${SRC}/libprotobuf-mutator -mkdir ${SRC}/LPM -cd ${SRC}/LPM -cmake ../libprotobuf-mutator -GNinja -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON -DLIB_PROTO_MUTATOR_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -ninja +# If building outside of oss-fuzz, we need LPM +if [ ! -d ${SRC}/LPM ]; then + git clone https://github.com/google/libprotobuf-mutator ${SRC}/libprotobuf-mutator + + mkdir ${SRC}/LPM \ + && cd ${SRC}/LPM \ + && cmake ../libprotobuf-mutator -GNinja -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON -DLIB_PROTO_MUTATOR_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \ + && ninja +fi