From be2ff22a825855813c8e79c287e037d1dce66c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 13 Nov 2018 22:19:30 +0100 Subject: [PATCH] Fix GitHub #90 ("UBSAN failures detected in preflight CI PR") --- doc/container.qbk | 2 ++ .../container/detail/multiallocation_chain.hpp | 15 ++++++++++----- include/boost/container/pmr/resource_adaptor.hpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index 637bdeb..2061f27 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1261,6 +1261,8 @@ use [*Boost.Container]? There are several reasons for that: * [@https://github.com/boostorg/container/pull/84 GitHub #84: ['"Allow vector to be assigned to itself"]]. * [@https://github.com/boostorg/container/pull/85 GitHub #85: ['"container: misc-typos"]]. * [@https://github.com/boostorg/container/pull/86 GitHub #86: ['"Add missing warning re-enabling include"]]. + * [@https://github.com/boostorg/container/issues/90 GitHub #90: ['"UBSAN failures detected in preflight CI PR "]]. + [endsect] diff --git a/include/boost/container/detail/multiallocation_chain.hpp b/include/boost/container/detail/multiallocation_chain.hpp index bc3b285..c7d94f4 100644 --- a/include/boost/container/detail/multiallocation_chain.hpp +++ b/include/boost/container/detail/multiallocation_chain.hpp @@ -171,11 +171,16 @@ class basic_multiallocation_chain std::pair extract_data() { - std::pair ret - (slist_impl_.begin().operator->() - ,slist_impl_.last().operator->()); - slist_impl_.clear(); - return ret; + if(BOOST_LIKELY(!slist_impl_.empty())){ + std::pair ret + (slist_impl_.begin().operator->() + ,slist_impl_.last().operator->()); + slist_impl_.clear(); + return ret; + } + else { + return std::pair(); + } } }; diff --git a/include/boost/container/pmr/resource_adaptor.hpp b/include/boost/container/pmr/resource_adaptor.hpp index f5ce5c8..3340626 100644 --- a/include/boost/container/pmr/resource_adaptor.hpp +++ b/include/boost/container/pmr/resource_adaptor.hpp @@ -172,7 +172,7 @@ class resource_adaptor {} explicit resource_adaptor(BOOST_RV_REF(Allocator) a2) - : base_t(BOOST_MOVE_BASE(base_t, a2)) + : base_t(::boost::move(a2)) {} resource_adaptor& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor) other)