Skip to content

Commit 7d73ab6

Browse files
committed
fix: disable unsigned integer overflow sanitization in build configurations
1 parent d4034f1 commit 7d73ab6

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

build-scripts/config_common.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ if (NOT WAMR_BUILD_SANITIZER STREQUAL "")
196196
message(FATAL_ERROR "Unsupported sanitizers: ${INVALID_SANITIZERS}")
197197
endif()
198198
# common flags for all sanitizers
199-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fno-sanitize-recover=all")
199+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fno-sanitize-recover=all -fno-sanitize=alignment")
200+
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
201+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=unsigned-integer-overflow")
202+
endif()
200203
if(SANITIZER_FLAGS)
201204
string(REPLACE ";" "," SANITIZER_FLAGS_STR "${SANITIZER_FLAGS}")
202205
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER_FLAGS_STR}")

tests/fuzz/wasm-mutator-fuzz/aot-compiler/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,15 @@ if(NOT IN_OSS_FUZZ)
7373
-fprofile-instr-generate -fcoverage-mapping
7474
-fno-sanitize-recover=all
7575
-fsanitize=address,undefined
76-
-fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability
76+
-fsanitize=float-divide-by-zero,local-bounds,nullability
7777
-fno-sanitize=alignment
7878
)
7979
target_link_options(aotclib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate)
8080
endif()
8181

82+
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
83+
target_compile_options(aotclib PUBLIC -fno-sanitize=unsigned-integer-overflow)
84+
endif()
85+
8286
add_executable(aot_compiler_fuzz aot_compiler_fuzz.cc)
8387
target_link_libraries(aot_compiler_fuzz PRIVATE stdc++ aotclib)

tests/fuzz/wasm-mutator-fuzz/wasm-mutator/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ if(NOT IN_OSS_FUZZ)
6363
-fprofile-instr-generate -fcoverage-mapping
6464
-fno-sanitize-recover=all
6565
-fsanitize=address,undefined
66-
-fsanitize=float-divide-by-zero,unsigned-integer-overflow,local-bounds,nullability
66+
-fsanitize=float-divide-by-zero,local-bounds,nullability
6767
-fno-sanitize=alignment
6868
)
6969
target_link_options(vmlib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate)
7070
endif()
71+
72+
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
73+
target_compile_options(vmlib PUBLIC -fno-sanitize=unsigned-integer-overflow)
74+
endif()

0 commit comments

Comments
 (0)