From 43f0f9d08a8820645c452f8398240a3d6a803fcd Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Mon, 9 Jan 2017 15:00:02 +0100 Subject: [PATCH] Fix error flagged by -fsanitize=nonnull-attribute Summary: this fixes the error reported by -fsanitize=nonnull-attribute analyzer: /workdir/UnpackedTarball/boost/boost/circular_buffer/debug.hpp:37:17: runtime error: null pointer passed as argument 1, which is declared to never be null > /usr/include/string.h:62:62: note: nonnull attribute specified here --- include/boost/circular_buffer/debug.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/circular_buffer/debug.hpp b/include/boost/circular_buffer/debug.hpp index b6ab0fef..79496b91 100644 --- a/include/boost/circular_buffer/debug.hpp +++ b/include/boost/circular_buffer/debug.hpp @@ -34,7 +34,7 @@ const int UNINITIALIZED = 0xcc; template inline void do_fill_uninitialized_memory(T* data, std::size_t size_in_bytes) BOOST_NOEXCEPT { - std::memset(static_cast(data), UNINITIALIZED, size_in_bytes); + if (size_in_bytes != 0) std::memset(static_cast(data), UNINITIALIZED, size_in_bytes); } template