From 7b245a99ceac76b55068291320643b30860c01ba Mon Sep 17 00:00:00 2001 From: David Lacey Date: Sun, 26 Feb 2017 08:21:14 +0000 Subject: [PATCH] Fix invalid insertion hint to underlying set container The code in the add_segment function tries to get the prior of an iterator that may be the first iterator of the underlying set container. This is then used as an insertion hint which causes a segfault in some standard container libraries. The fix is to use cyclic_prior instead. This is a fix for ticket #12872. --- include/boost/icl/interval_base_set.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/icl/interval_base_set.hpp b/include/boost/icl/interval_base_set.hpp index 045b23c..b6277e2 100644 --- a/include/boost/icl/interval_base_set.hpp +++ b/include/boost/icl/interval_base_set.hpp @@ -437,7 +437,7 @@ inline void interval_base_set if(!icl::is_empty(lead_gap)) // [lead_gap--- . . . // [prior_) [-- it_ ... - this->_set.insert(prior(it_), lead_gap); + this->_set.insert(cyclic_prior(*this, it_), lead_gap); // . . . --------- . . . addend interval // [-- it_ --) has a common part with the first overval