File tree Expand file tree Collapse file tree 9 files changed +53
-4
lines changed Expand file tree Collapse file tree 9 files changed +53
-4
lines changed Original file line number Diff line number Diff line change 98
98
if-no-files-found : error
99
99
retention-days : 7
100
100
101
+ asan :
102
+ runs-on : ubuntu-latest
103
+ steps :
104
+ - name : Setup Git
105
+ run : |
106
+ git config --global core.autocrlf false
107
+ git config --global core.eol lf
108
+ - name : Checkout sources
109
+ uses : actions/checkout@v3
110
+ - name : Build
111
+ run : |
112
+ mkdir -p build
113
+ cd build
114
+ cmake -DYARAMOD_TESTS=ON -DYARAMOD_ASAN=ON ..
115
+ cmake --build . -- -j
116
+ # Disable ASLR for this, see https://stackoverflow.com/questions/77894856/possible-bug-in-gcc-sanitizers
117
+ - name : Tests
118
+ echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
119
+ ./build/tests/cpp/yaramod_tests
120
+
101
121
release :
102
122
if : ${{ startsWith(github.ref, 'refs/tags/v') }}
103
- needs : tests
123
+ needs :
124
+ - tests
125
+ - asan
104
126
runs-on : ubuntu-latest
105
127
steps :
106
128
- name : Downloads wheels
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ option(YARAMOD_TESTS "Build tests for yaramod" OFF)
10
10
option (YARAMOD_DOCS "Build doxygen documentation for yaramod" OFF )
11
11
option (YARAMOD_PYTHON "Build Python extension" OFF )
12
12
option (YARAMOD_EXAMPLES "Build examples" OFF )
13
+ option (YARAMOD_ASAN "Build with ASAN" OFF )
13
14
14
15
# Add CMake module path.
15
16
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR} /cmake" )
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ if(CMAKE_CXX_COMPILER)
12
12
endif ()
13
13
14
14
ExternalProject_Add (googletest
15
- URL https://github.com/google/googletest/archive/58d77fa8070e8cec2dc1ed015d66b454c8d78850 .zip
16
- URL_HASH SHA256=ab78fa3f912d44d38b785ec011a25f26512aaedc5291f51f3807c592b506d33a
15
+ URL https://github.com/google/googletest/archive/a7f443b80b105f940225332ed3c31f2790092f47 .zip
16
+ URL_HASH SHA256=ecb351335da20ab23ea5f14c107a10c475dfdd27d8a50d968757942280dffbe3
17
17
CMAKE_ARGS
18
18
# This does not work on MSVC, but is useful on Linux.
19
19
-DCMAKE_BUILD_TYPE=Release
Original file line number Diff line number Diff line change 1
- pytest >= 4 .2.0 , < 5 .0.0
1
+ pytest >= 6 .2.5 , < 7 .0.0
2
2
pypandoc >= 1.4
3
3
setuptools >= 62.4.0
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ if(NOT TARGET yaramod)
63
63
# Filesystem library.
64
64
target_link_libraries (yaramod Filesystem::Filesystem )
65
65
66
+ # Address sanitizer.
67
+ if (YARAMOD_ASAN )
68
+ target_compile_options (yaramod PRIVATE "-fsanitize=address" "-fno-omit-frame-pointer" )
69
+ target_link_options (yaramod PRIVATE "-fsanitize=address" )
70
+ endif ()
71
+
66
72
# Python module.
67
73
if (YARAMOD_PYTHON )
68
74
add_subdirectory (python )
Original file line number Diff line number Diff line change 1
1
add_executable (dump-rules-ast main.cpp )
2
2
target_link_libraries (dump-rules-ast yaramod )
3
+
4
+ if (YARAMOD_ASAN )
5
+ target_compile_options (dump-rules-ast PRIVATE "-fsanitize=address" "-fno-omit-frame-pointer" )
6
+ target_link_options (dump-rules-ast PRIVATE "-fsanitize=address" )
7
+ endif ()
Original file line number Diff line number Diff line change 1
1
add_executable (simplify-bools main.cpp )
2
2
target_link_libraries (simplify-bools yaramod )
3
+
4
+ if (YARAMOD_ASAN )
5
+ target_compile_options (simplify-bools PRIVATE "-fsanitize=address" "-fno-omit-frame-pointer" )
6
+ target_link_options (simplify-bools PRIVATE "-fsanitize=address" )
7
+ endif ()
Original file line number Diff line number Diff line change @@ -16,3 +16,8 @@ endif()
16
16
17
17
set_target_properties (yaramod-python PROPERTIES OUTPUT_NAME "yaramod" )
18
18
target_link_libraries (yaramod-python PUBLIC yaramod )
19
+
20
+ if (YARAMOD_ASAN )
21
+ target_compile_options (yaramod-python PRIVATE "-fsanitize=address" "-fno-omit-frame-pointer" )
22
+ target_link_options (yaramod-python PRIVATE "-fsanitize=address" )
23
+ endif ()
Original file line number Diff line number Diff line change @@ -24,4 +24,9 @@ if(NOT TARGET yaramod_tests)
24
24
25
25
# Includes.
26
26
target_include_directories (yaramod_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR} " )
27
+
28
+ if (YARAMOD_ASAN )
29
+ target_compile_options (yaramod_tests PRIVATE "-fsanitize=address" "-fno-omit-frame-pointer" )
30
+ target_link_options (yaramod_tests PRIVATE "-fsanitize=address" )
31
+ endif ()
27
32
endif ()
You can’t perform that action at this time.
0 commit comments