diff --git a/CHANGES b/CHANGES index 29a71ca209..62ff25f713 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ +2.6-408 | 2019-06-13 11:19:50 -0700 + + * Fix potential null-dereference in current_time() (Tim Wojtulewicz, Corelight) + + * Add --sanitizers configure script to enable Clang sanitizers (Tim Wojtulewicz, Corelight) + 2.6-404 | 2019-06-12 15:10:19 -0700 * Rename directories from bro to zeek (Daniel Thayer) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f0cbd6d29..b8db7b52f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,12 @@ if ( NOT BINARY_PACKAGING_MODE ) _make_install_dir_symlink("${CMAKE_INSTALL_PREFIX}/lib/bro" "${CMAKE_INSTALL_PREFIX}/lib/zeek") endif () +if ( SANITIZERS ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") + set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") +endif() + ######################################################################## ## Dependency Configuration diff --git a/VERSION b/VERSION index f3764461d6..54b7ae064a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-404 +2.6-408 diff --git a/configure b/configure index eb6a38f1a0..ec344d808f 100755 --- a/configure +++ b/configure @@ -58,6 +58,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]... --disable-perftools don't try to build with Google Perftools --disable-python don't try to build python bindings for Broker --disable-broker-tests don't try to build Broker unit tests + --sanitizers=SANITIZERS comma-separated list of Clang sanitizers to enable Required Packages in Non-Standard Locations: --with-openssl=PATH path to OpenSSL install root @@ -144,6 +145,7 @@ append_cache_entry INSTALL_ZEEKCTL BOOL true append_cache_entry CPACK_SOURCE_IGNORE_FILES STRING append_cache_entry ENABLE_MOBILE_IPV6 BOOL false append_cache_entry DISABLE_PERFTOOLS BOOL false +append_cache_entry SANITIZERS STRING "" # parse arguments while [ $# -ne 0 ]; do @@ -216,6 +218,9 @@ while [ $# -ne 0 ]; do append_cache_entry ENABLE_PERFTOOLS BOOL true append_cache_entry ENABLE_PERFTOOLS_DEBUG BOOL true ;; + --sanitizers=*) + append_cache_entry SANITIZERS STRING $optarg + ;; --enable-jemalloc) append_cache_entry ENABLE_JEMALLOC BOOL true ;; diff --git a/src/util.cc b/src/util.cc index 7a5eb41c5f..2a6a5c37c4 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1507,13 +1507,11 @@ double current_time(bool real) double t = double(tv.tv_sec) + double(tv.tv_usec) / 1e6; - const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs()); - - if ( ! pseudo_realtime || real || pkt_srcs.empty() ) + if ( ! pseudo_realtime || real || ! iosource_mgr || iosource_mgr->GetPktSrcs().empty() ) return t; // This obviously only works for a single source ... - iosource::PktSrc* src = pkt_srcs.front(); + iosource::PktSrc* src = iosource_mgr->GetPktSrcs().front(); if ( net_is_processing_suspended() ) return src->CurrentPacketTimestamp();