From 71b99683b9bea25e116ba6c00e5b275186971c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 21 Apr 2014 22:52:06 +0200 Subject: [PATCH] Reverted a (premature) optimization that can lead to out of bound write. --- include/boost/container/detail/flat_tree.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index 2988ebb..851e15f 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -549,7 +549,9 @@ class flat_tree pos = const_cast(*this).priv_lower_bound(pos, ce, KeyOfValue()(val)); //Check if already present if (pos != ce && !val_cmp(val, *pos)){ - skips[unique_burst-1] += static_cast(unique_burst > 0); + if(unique_burst > 0){ + ++skips[unique_burst-1]; + } continue; }