-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add CLI11 to OSS-Fuzz (CLI parsing fuzzer) #14131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
7ea34af
95cb13a
562fd85
895c7aa
e7b3e81
f7e089e
857bba3
042a0e0
78998b4
233ed01
8ceffc8
9c78aa8
758303c
ea72da3
edab7cb
3dfc301
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||
| #!/bin/bash -eu | ||||||
| # Copyright 2025 Google LLC | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| # 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 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/" | ||||||
| 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: | ||
| - 140903820+TheodorNEngoy@users.noreply.github.com | ||
| primary_contact: phlptp@gmail.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.