diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-05-25 19:35:52 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-29 16:05:23 -0700 |
| commit | 33dc5d611f578ace9833a80dc006a34b09da18af (patch) | |
| tree | 2351fd7d197530493dbd27034ae9e1546c2e299c /CMakeLists.txt | |
| parent | fe5336ec1f9f27045f2c27ac253285c8447aa653 (diff) | |
| download | nng-33dc5d611f578ace9833a80dc006a34b09da18af.tar.gz nng-33dc5d611f578ace9833a80dc006a34b09da18af.tar.bz2 nng-33dc5d611f578ace9833a80dc006a34b09da18af.zip | |
fixes #484 crashes in websocket transport
fixes #490 posix_epdesc use-after-free bug
fixes #489 Sanitizer based testing would help
fixes #492 Numerous memory leaks found with sanitizer
This introduces support for compiler-based sanitizers when using
clang or gcc (and not on Windows). See NNG_SANITIZER for possible
settings such as "thread" or "address".
Furthermore, we have fixed the issues we found with both the
thread and address sanitizers. We believe that the thread issues
pointed to a low frequency use-after-free responsible for rare
crashes in some of the tests.
The tests generally have their timeouts doubled when running under
a sanitizer, to account for the extra long times that the sanitizer
can cause these to take.
While here, we also changed the compat_ws test to avoid a particularly
painful and time consuming DNS lookup, and we made the nngcat_unlimited
test a bit more robust by waiting before sending traffic.
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 60b1726c..36ba269f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,11 +239,17 @@ endif() # Platform checks. if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - set(NNG_WARN_FLAGS "-Wall -Wextra") + set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") - set(NNG_WARN_FLAGS "-Wall -Wextra") + set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer") elseif (CMAKE_C_COMPILER_ID STREQUAL "AppleClang") - set(NNG_WARN_FLAGS "-Wall -Wextra") + set(NNG_WARN_FLAGS "-Wall -Wextra -fno-omit-frame-pointer") +endif() + +include (CheckSanitizer) +CheckSanitizer() +if (NOT NNG_SANITIZER STREQUAL "none") + set (NNG_SANITIZER_FLAGS "-fsanitize=${NNG_SANITIZER}") endif() if (NNG_ENABLE_COVERAGE) @@ -261,8 +267,8 @@ if (NNG_ENABLE_COVERAGE) endif() endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS} ${NNG_SANITIZER_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NNG_WARN_FLAGS} ${NNG_COVERAGE_FLAGS} ${NNG_SANITIZER_FLAGS}") TEST_BIG_ENDIAN(NNG_BIG_ENDIAN) if (NNG_BIG_ENDIAN) @@ -280,6 +286,8 @@ if (NOT WIN32 AND NOT CYGWIN) endif() endif() + + find_package (Threads REQUIRED) if (CMAKE_SYSTEM_NAME MATCHES "Linux") |
