Fix #344 fuzzing crash in simplecpp::preprocess() #514
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-unixish | |
on: [push, pull_request] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
compiler: [clang++, g++] | |
os: [ubuntu-20.04, ubuntu-22.04, macos-13, macos-14] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
env: | |
CXX: ${{ matrix.compiler }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install missing software on ubuntu | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install valgrind | |
- name: make simplecpp | |
run: make -j$(nproc) | |
- name: make test | |
run: make -j$(nproc) test | |
- name: selfcheck | |
run: | | |
make -j$(nproc) selfcheck | |
- name: Run CMake | |
run: | | |
cmake -S . -B cmake.output | |
- name: CMake simplecpp | |
run: | | |
cmake --build cmake.output --target simplecpp -- -j $(nproc) | |
- name: CMake testrunner | |
run: | | |
cmake --build cmake.output --target testrunner -- -j $(nproc) | |
./cmake.output/testrunner | |
- name: Run valgrind | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
make clean | |
# this valgrind version doesn't support DWARF 5 yet | |
make -j$(nproc) CXXFLAGS="-gdwarf-4" | |
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner | |
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./simplecpp simplecpp.cpp -e | |
- name: Run with libstdc++ debug mode | |
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'g++' | |
run: | | |
make clean | |
make -j$(nproc) test selfcheck CXXFLAGS="-g3 -D_GLIBCXX_DEBUG" | |
# TODO: change it to -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG when the compiler is at least Clang 18 | |
- name: Run with libc++ debug mode | |
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++' | |
run: | | |
make clean | |
make -j$(nproc) test selfcheck CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_ENABLE_ASSERTIONS=1" LDFLAGS="-lc++" | |
- name: Run AddressSanitizer | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
make clean | |
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address" | |
env: | |
ASAN_OPTIONS: detect_stack_use_after_return=1 | |
- name: Run UndefinedBehaviorSanitizer | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
make clean | |
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow" | |
# TODO: requires instrumented libc++ | |
- name: Run MemorySanitizer | |
if: false && matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++' | |
run: | | |
make clean | |
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory" |