From 70a6a0c0ea313003f08dc963d605d1edc47a5433 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Sun, 10 May 2026 03:56:13 +0900 Subject: [PATCH] Run v3 C tests in GitHub CI ci.yml: two new jobs. - v3-c-tests builds tester_v3_c (security regressions) and tester_v3_c_v1port (18 ported v1 unit tests) with the default system cc (gcc on ubuntu-latest) and runs both. - v3-c-tests-sanitizers rebuilds the same suites under clang with -fsanitize=address,undefined and ASAN_OPTIONS=halt_on_error=1 plus leak detection so memory-safety regressions break CI. c-cpp.yml: add a v3_c_tests step to build-linux so the legacy gcc workflow also exercises the v3 C parser end-to-end. Both invoke the parser via parse_auto with TINYGLTF3_ENABLE_FS so the external-file paths (and the new path-traversal/file-size guards) are exercised end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/c-cpp.yml | 11 ++++++ .github/workflows/ci.yml | 68 +++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index ffc5370..0576f56 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -100,6 +100,17 @@ jobs: ./tester_noexcept cd .. + - name: v3_c_tests + run: | + cd tests + cc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS \ + -o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c + ./tester_v3_c + cc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS \ + -o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c + ./tester_v3_c_v1port + cd .. + build-rapidjson-linux: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce6a7f7..c65f976 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -328,3 +328,71 @@ jobs: cd tests clang++ -fsanitize=undefined -I../ -std=c++11 -g -O1 -o tester tester.cc ./tester + + # v3 C runtime: internal security regression tests + ported v1 unit tests. + v3-c-tests: + runs-on: ubuntu-latest + name: v3 C tests (Linux x64) + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build tester_v3_c + run: | + cd tests + cc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS \ + -o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c + + - name: Build tester_v3_c_v1port + run: | + cd tests + cc -I../ -std=c11 -g -O0 -DTINYGLTF3_ENABLE_FS \ + -o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c + + - name: Run tester_v3_c (security regressions) + run: | + cd tests + ./tester_v3_c + + - name: Run tester_v3_c_v1port (18 ported unit tests) + run: | + cd tests + ./tester_v3_c_v1port + + # v3 C runtime under ASan + UBSan for memory-safety + UB checks. + v3-c-tests-sanitizers: + runs-on: ubuntu-latest + name: v3 C tests (Clang ASan + UBSan) + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build tester_v3_c with ASan + UBSan + run: | + cd tests + clang -I../ -std=c11 -g -O1 -DTINYGLTF3_ENABLE_FS \ + -fsanitize=address,undefined -fno-omit-frame-pointer \ + -o tester_v3_c tester_v3_c.c ../tiny_gltf_v3.c + + - name: Build tester_v3_c_v1port with ASan + UBSan + run: | + cd tests + clang -I../ -std=c11 -g -O1 -DTINYGLTF3_ENABLE_FS \ + -fsanitize=address,undefined -fno-omit-frame-pointer \ + -o tester_v3_c_v1port tester_v3_c_v1port.c ../tiny_gltf_v3.c + + - name: Run tester_v3_c + env: + ASAN_OPTIONS: detect_leaks=1:halt_on_error=1 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 + run: | + cd tests + ./tester_v3_c + + - name: Run tester_v3_c_v1port + env: + ASAN_OPTIONS: detect_leaks=1:halt_on_error=1 + UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 + run: | + cd tests + ./tester_v3_c_v1port