Skip to content

Commit

Permalink
Add AddressSanitizer
Browse files Browse the repository at this point in the history
Do not override the compilers (the CC and CXX environment variables).

Build libaom with sanitizer support using the -DSANITIZE=<type> cmake
option.
  • Loading branch information
wantehchang committed Mar 19, 2024
1 parent 2a4b6b1 commit 766e3a7
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/ci-unix-static-sanitized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
sanitizer: [ undefined ] # TODO(yguyon): Add address, memory, thread

env:
CC: clang
CXX: clang++
sanitizer: [ address, undefined ] # TODO(yguyon): Add memory, thread

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand All @@ -41,11 +37,10 @@ jobs:
- name: Build aom
if: steps.cache-ext.outputs.cache-hit != 'true'
working-directory: ./ext
run: ./aom.cmd
env:
CFLAGS: -fsanitize=${{ matrix.sanitizer }}
CXXFLAGS: -fsanitize=${{ matrix.sanitizer }}
LDFLAGS: -fsanitize=${{ matrix.sanitizer }}
run: >
sed -i -e 's/cmake -G Ninja \(.*\) \.\./cmake -G Ninja \1 -DSANITIZE=${{ matrix.sanitizer }} ../g' aom.cmd
./aom.cmd
- name: Build dav1d
if: steps.cache-ext.outputs.cache-hit != 'true'
working-directory: ./ext
Expand Down Expand Up @@ -92,5 +87,6 @@ jobs:
run: ninja
- name: Run AVIF Tests
working-directory: ./build
# ASAN_OPTIONS=allocator_may_return_null=1 may be necessary for address sanitizer.
run: ctest -j $(getconf _NPROCESSORS_ONLN) --output-on-failure
env:
ASAN_OPTIONS: allocator_may_return_null=1

0 comments on commit 766e3a7

Please sign in to comment.