forked from boostorg/container
Fixes GitHub #75 ("flat_set: Heap overflow")
This commit is contained in:
@ -1253,6 +1253,7 @@ use [*Boost.Container]? There are several reasons for that:
|
||||
* [@https://svn.boost.org/trac/boost/ticket/13533 Trac #13533: ['"Boost vector resize causes assert(false)"]].
|
||||
* [@https://github.com/boostorg/container/issues/73 GitHub #73: ['"triviality of pair"]].
|
||||
* [@https://github.com/boostorg/container/issues/74 GitHub #74: ['"vector assignment not using memcpy"]].
|
||||
* [@https://github.com/boostorg/container/issues/75 GitHub #75: ['"flat_set: Heap overflow"]].
|
||||
* Fixed race condition bug in [classref boost::container::pmr::unsynchronized_pool_resource unsynchronized_pool_resource]
|
||||
found by Arthur O'Dowyer in his blog post
|
||||
[@https://quuxplusone.github.io/blog/2018/06/05/libcpp-memory-resource/ <memory_resource> for libc++]
|
||||
|
@ -2197,11 +2197,11 @@ class vector
|
||||
template<class InputIt, class Compare>
|
||||
BOOST_CONTAINER_FORCEINLINE void merge_unique(InputIt first, InputIt last, Compare comp)
|
||||
{
|
||||
size_type const s = this->size();
|
||||
size_type const old_size = this->size();
|
||||
this->priv_set_difference_back(first, last, comp);
|
||||
T *const raw_beg = this->priv_raw_begin();
|
||||
T *const raw_end = this->priv_raw_end();
|
||||
T *raw_pos = raw_beg + s;
|
||||
T *raw_pos = raw_beg + old_size;
|
||||
boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, this->capacity() - this->size());
|
||||
}
|
||||
|
||||
@ -2278,14 +2278,14 @@ class vector
|
||||
|
||||
if (comp(*first1, *first2)) {
|
||||
this->emplace_back(*first1);
|
||||
//Reallocation happened, update range
|
||||
T * const raw_begin = this->priv_raw_begin();
|
||||
if(old_first2 != raw_begin){
|
||||
if(old_first2 != raw_begin)
|
||||
{
|
||||
//Reallocation happened, update range
|
||||
first2 = raw_begin + (first2 - old_first2);
|
||||
last2 = first2 + (last2 - old_first2);
|
||||
last2 = raw_begin + (last2 - old_first2);
|
||||
old_first2 = raw_begin;
|
||||
}
|
||||
|
||||
++first1;
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user