Skip to content

Commit 7f9849c

Browse files
committed
Fuzzing: build with ASAN as well
1 parent 4485965 commit 7f9849c

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/build_and_fuzz.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,39 @@ jobs:
2626
-DENABLE_STATIC=ON \
2727
-B build-msan
2828
cmake --build build-msan
29+
30+
fuzz_asan:
31+
name: fuzz with AddressSanitizer
32+
runs-on: ubuntu-latest
33+
container: ubuntu:23.04
34+
35+
steps:
36+
37+
- name: install dependencies from package management
38+
env:
39+
DEBIAN_FRONTEND: noninteractive
40+
run: |
41+
apt -q -y update
42+
apt -q -y install \
43+
llvm-16 clang-16 lld-16 \
44+
build-essential cmake ninja-build pkg-config \
45+
libssl-dev libedit-dev libcurl4-openssl-dev libusb-1.0-0-dev libpcsclite-dev gengetopt
46+
47+
- name: clone the Yubico/yubihsm-shell repository
48+
uses: actions/checkout@v3
49+
with:
50+
path: yubihsm-shell
51+
52+
- name: do build
53+
env:
54+
CC: clang-16
55+
CXX: clang++-16
56+
working-directory: yubihsm-shell
57+
run: |
58+
cmake \
59+
-DFUZZING=ON \
60+
-DWITHOUT_MANPAGES=ON \
61+
-DDISABLE_LTO=ON \
62+
-DENABLE_STATIC=ON \
63+
-B build-asan
64+
cmake --build build-asan

cmake/SecurityFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
44
CMAKE_C_COMPILER_ID STREQUAL "AppleClang" OR
55
CMAKE_C_COMPILER_ID STREQUAL "GNU")
66

7-
add_compile_options (-Wall -Wextra -Werror)
87
add_compile_options (-Wformat -Wformat-nonliteral -Wformat-security)
98
add_compile_options (-Wshadow)
109
add_compile_options (-Wcast-qual)
@@ -13,6 +12,7 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" OR
1312
add_compile_options (-pedantic -pedantic-errors)
1413
add_compile_options (-fpie -fpic)
1514
if (NOT FUZZING)
15+
add_compile_options (-Wall -Wextra -Werror)
1616
add_compile_options(-O2)
1717
add_definitions (-D_FORTIFY_SOURCE=2)
1818
endif ()

0 commit comments

Comments
 (0)