fix: issue found by fuzzing (#846)

* Add the beginnings of a fuzzing system for CLI11.  This commit adds the fuzzing code, a simple test, and two fixes to issues(seg faults) found by the initial round of fuzzing.  It also adds a few tests and coverage issues uncovered in the process of developing the fuzz tests. As a side effect adjusts some of the azure tests to specify the vmImage which was being changed on azure.

* update license to match rest of code base

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Philip Top
2023-03-09 12:02:49 -08:00
committed by GitHub
parent fc9cea6d76
commit 0a615f854d
23 changed files with 605 additions and 27 deletions

2
.github/codecov.yml vendored
View File

@@ -1,6 +1,6 @@
codecov:
notify:
after_n_builds: 4
after_n_builds: 8
coverage:
status:
project:

54
.github/workflows/fuzz.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: Fuzz
on:
workflow_dispatch:
push:
branches:
- main
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quick_fuzz1:
name: quickfuzz1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_CXX_STANDARD=17 \
-DCLI11_SINGLE_FILE_TESTS=OFF \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_FUZZ_TARGET=ON \
-DCLI11_BUILD_TESTS=OFF \
-DCLI11_BUILD_DOCS=OFF \
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_COMPILER_FORCED=ON \
-DCMAKE_CXX_FLAGS="-g -O1 -fsanitize=fuzzer,undefined,address"
- name: Build
run: cmake --build build -j4
- name: Test
run: |
cd build
make QUICK_CLI11_APP_FUZZ
- name: Test2
run: |
cd build
make QUICK_CLI11_FILE_FUZZ
- name: artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: file_failure
path: ./build/fuzz/cli11_*_fail_artifact.txt

View File

@@ -48,7 +48,7 @@ jobs:
- name: Prepare coverage
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/examples/*' '/usr/*' '*/book/*' '*/fuzz/*' --output-file coverage.info
lcov --list coverage.info
working-directory: build