Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions projects/cli11/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions projects/cli11/build.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fuzz_dictionary2 file is meant for the file_fuzzer, it probably isn't that useful to concatenate them. For the app fuzzer just fuzz_dictionary1 should be used.

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/"
15 changes: 15 additions & 0 deletions projects/cli11/project.yaml
Original file line number Diff line number Diff line change
@@ -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:
- [email protected]
primary_contact: [email protected]