From 369f10188c54e7045616ee28dbc93b736e2af86c Mon Sep 17 00:00:00 2001 From: Nikolaj Schlej Date: Fri, 14 Feb 2025 07:46:55 +0100 Subject: [PATCH] Enable building ffsparser_fuzzer during CI/CD, improve readUnaligned to silence Clang UBSAN --- .github/workflows/main.yml | 30 +++++++++++++++++++++++++++++- common/utility.h | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 677c773..bf45a0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -299,7 +299,35 @@ jobs: run: | cmake -G "MinGW Makefiles" -B build . cmake --build build --parallel - + + build_test_linux_fuzzer: + name: Fuzzer build test (Clang, Linux x64) + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Create build directory + run: cmake -E make_directory ${{runner.workspace}}/build + - name: Configure everything + working-directory: ${{runner.workspace}}/build + run: CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ../UEFITool/fuzzing + - name: Build everything + working-directory: ${{runner.workspace}}/build + shell: bash + run: cmake --build . + - name: Create dist directory + run: cmake -E make_directory ${{runner.workspace}}/dist + - name: Archive everything + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + UEFITOOL_VER=$(cat ../UEFITool/version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/') ; \ + zip -qryj ../dist/ffsparser_fuzzer_NE_${UEFITOOL_VER}_x64_linux.zip ./ffsparser_fuzzer + - name: Upload to artifacts + uses: actions/upload-artifact@v4 + with: + name: Fuzzer + path: ${{runner.workspace}}/dist/*.zip + # Static Analysis build_analyze_linux_coverity: env: diff --git a/common/utility.h b/common/utility.h index 7a24e2a..4529774 100755 --- a/common/utility.h +++ b/common/utility.h @@ -70,7 +70,7 @@ INTN findPattern(const UINT8 *pattern, const UINT8 *patternMask, UINTN patternSi template inline T readUnaligned(const T *v) { T tmp = {}; - memcpy(&tmp, v, sizeof(T)); + memcpy(reinterpret_cast(&tmp), reinterpret_cast(v), sizeof(T)); return tmp; }