diff --git a/projects/cli11/Dockerfile b/projects/cli11/Dockerfile new file mode 100644 index 000000000000..c44c3c549540 --- /dev/null +++ b/projects/cli11/Dockerfile @@ -0,0 +1,19 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM gcr.io/oss-fuzz-base/base-builder +RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* +RUN git clone --depth=1 https://github.com/CLIUtils/CLI11.git $SRC/cli11 +COPY build.sh $SRC/ +WORKDIR $SRC diff --git a/projects/cli11/build.sh b/projects/cli11/build.sh new file mode 100755 index 000000000000..2ed3c254e194 --- /dev/null +++ b/projects/cli11/build.sh @@ -0,0 +1,30 @@ +#!/bin/bash -eu +# Copyright 2025 Google LLC +# Licensed under the Apache License, Version 2.0 +# See the License for the specific language governing permissions and +# limitations under the License. +set -o pipefail + +# --- Build the upstream CLI11 fuzz harness --- +"$CXX" ${CXXFLAGS:-} -std=c++17 -I"$SRC/cli11/include" \ + "$SRC/cli11/fuzz/cli11_app_fuzz.cpp" "$SRC/cli11/fuzz/fuzzApp.cpp" \ + -o "$OUT/cli11_app_fuzzer" $LIB_FUZZING_ENGINE ${LDFLAGS:-} + +# --- Package dictionary (if present) --- +if [[ -f "$SRC/cli11/fuzz/fuzz_dictionary1.txt" ]]; then + cp "$SRC/cli11/fuzz/fuzz_dictionary1.txt" "$OUT/cli11_app_fuzzer.dict" || true +fi + +# --- Tiny, non-crashing seed corpus (zip + plain dir) --- +seeddir=/tmp/cli11_seeds +rm -rf "$seeddir" "$OUT/cli11_app_fuzzer_seed_corpus" || true +mkdir -p "$seeddir" "$OUT/cli11_app_fuzzer_seed_corpus" + +: > "$seeddir/empty" # zero-byte; must not crash +printf -- '--help\n' > "$seeddir/help" + +# 1) Flat zip (no subdirectories) for libFuzzer/Honggfuzz +zip -j -q "$OUT/cli11_app_fuzzer_seed_corpus.zip" "$seeddir/empty" "$seeddir/help" + +# 2) Plain directory for AFL++ (used by check_build) +cp -f "$seeddir/empty" "$seeddir/help" "$OUT/cli11_app_fuzzer_seed_corpus/" diff --git a/projects/cli11/project.yaml b/projects/cli11/project.yaml new file mode 100644 index 000000000000..066777d3dc0b --- /dev/null +++ b/projects/cli11/project.yaml @@ -0,0 +1,15 @@ +homepage: https://github.com/CLIUtils/CLI11 +main_repo: https://github.com/CLIUtils/CLI11 +language: c++ +fuzzing_engines: +- honggfuzz +- libfuzzer +sanitizers: +- address +- undefined +architectures: +- i386 +- x86_64 +auto_ccs: +- 140903820+TheodorNEngoy@users.noreply.github.com +primary_contact: phlptp@gmail.com