Skip to content

Commit 843b280

Browse files
committed
added unsigned-integer-overflow to UBSAN
1 parent c826c21 commit 843b280

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

CMakeLists.txt

+6-7
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,14 @@ if(UBSAN)
710710
message(FATAL_ERROR "Cannot enable UBSAN unless using Clang")
711711
endif()
712712

713-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
714-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
715-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
716-
713+
set(SANITIZER_FLAGS "-fsanitize=undefined,unsigned-integer-overflow")
717714
if(NOT UBSAN_RECOVER)
718-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover=undefined")
719-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=undefined")
720-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-sanitize-recover=undefined")
715+
set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fno-sanitize-recover=undefined,unsigned-integer-overflow")
721716
endif()
717+
718+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
719+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
720+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
722721
endif()
723722

724723
if(GCOV)

0 commit comments

Comments
 (0)