From e0aaf744a53e3c710f3d6ee19a7b184f1a5a4da4 Mon Sep 17 00:00:00 2001 From: Gary Furnish Date: Mon, 5 Jun 2017 18:15:33 -0600 Subject: [PATCH] Fix integer rollover that triggers clang ubsan when U is unsigned --- include/boost/container/detail/copy_move_algo.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/container/detail/copy_move_algo.hpp b/include/boost/container/detail/copy_move_algo.hpp index 968f4ac..9044960 100644 --- a/include/boost/container/detail/copy_move_algo.hpp +++ b/include/boost/container/detail/copy_move_algo.hpp @@ -963,7 +963,8 @@ template inline typename container_detail::disable_if_trivially_destructible::type destroy_alloc_n(Allocator &a, I f, U n) { - while(n--){ + while(n){ + --n; allocator_traits::destroy(a, boost::movelib::iterator_to_raw_pointer(f)); ++f; }