fix: address PR review — fuzz target fixes, UBSan, CI improvements

Critical fixes:
- Add missing #include <string.h> to 5 fuzz targets (wouldn't compile with GCC14+/Clang16+)
- Fix fuzz_metadata_from_buf.c OOB read: guard size >= sizeof(int) + FILE_METADATA_WIRE_SIZE
- Add Clang compiler check for ENABLE_FUZZ in CMakeLists.txt (fail fast at configure time)
- Add fuzz-build CI job (install clang, build all 6 fuzz targets with ENABLE_FUZZ=ON)

Warning fixes:
- Add UBSan to sanitizer CI matrix (address + undefined)
- Remove tautological test_property_glob_consistency (pure/deterministic function)
- Use fixed seed srand(42) instead of srand(time(NULL)) for reproducible property tests
- Add valid-header + truncated-instructions delta robustness test (exercises instruction-loop error paths)
- Fix lcov --remove to exclude '*/_deps/*' (xxhash coverage pollution)
- Add comment explaining FASTSYNC_UNDER_VALGRIND skip in test_file.c
- Update .gitignore for build-*/ directories
This commit is contained in:
2026-07-19 22:43:24 +02:00
parent 20cfc5f438
commit c9369b7118
11 changed files with 72 additions and 25 deletions
+19 -2
View File
@@ -42,7 +42,7 @@ jobs:
needs: lint
strategy:
matrix:
sanitizer: [address]
sanitizer: [address, undefined]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -56,6 +56,23 @@ jobs:
- name: Unit Tests
run: ctest --test-dir build-${{ matrix.sanitizer }} --output-on-failure
fuzz-build:
runs-on: ubuntu-latest
container: gitea.tap-tap.win/taptap/fastsync-ci:v7
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install clang
run: apt-get update -qq && apt-get install -y -qq clang
- name: Configure (clang + fuzz)
run: CC=clang CXX=clang++ cmake -B build-fuzz -S . -DENABLE_FUZZ=ON
- name: Build fuzz targets
run: cmake --build build-fuzz -j$(nproc)
coverage:
runs-on: ubuntu-latest
container: gitea.tap-tap.win/taptap/fastsync-ci:v7
@@ -79,7 +96,7 @@ jobs:
- name: Coverage Report
run: |
lcov --capture --directory build --output-file coverage.info --branch-coverage
lcov --remove coverage.info '/usr/*' '*/tests/*' --output-file coverage.info --branch-coverage --ignore-errors unused
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/_deps/*' --output-file coverage.info --branch-coverage --ignore-errors unused
lcov --list coverage.info
valgrind: