Skip to content

Commit 2553a38

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

3 files changed

Lines changed: 12 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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ 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
)
79+
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
80+
target_compile_options(aotclib PUBLIC -fno-sanitize=unsigned-integer-overflow)
81+
endif()
7982
target_link_options(aotclib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate)
8083
endif()
8184

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ 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
)
69+
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
70+
target_compile_options(vmlib PUBLIC -fno-sanitize=unsigned-integer-overflow)
71+
endif()
6972
target_link_options(vmlib PUBLIC -fsanitize=address,undefined -fprofile-instr-generate)
7073
endif()

0 commit comments

Comments
 (0)