[Boost-bugs] [Boost C++ Libraries] #13533: Boost vector resize causes assert(false)

Subject: [Boost-bugs] [Boost C++ Libraries] #13533: Boost vector resize causes assert(false)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-04-20 20:11:38


#13533: Boost vector resize causes assert(false)
--------------------------------------------+---------------------------
 Reporter: Paul Calabrese <calabrese_p@…> | Owner: Ion Gaztañaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.67.0 | Severity: Problem
 Keywords: |
--------------------------------------------+---------------------------
 When using a boost vector with a custom allocator, a resize that results
 in memory growth in both directions causes an assert(false) in
 insert_value_initialized_n_proxy::copy_n_and_update(). The code in
 question is contained in boost/containers/detail/advanced_insert_int.hpp.

 I have attached a test case that results in an assert. The test case uses
 a custom allocator, but the problem was originally encountered using the
 boost shared memory allocator.

 The following patch appears to correct the behavior:
 {{{
 128,129c128,129
 < void copy_n_and_update(Allocator &, Iterator, size_type) const
 < { BOOST_ASSERT(false); }
 ---
> void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
> { boost::container::uninitialized_value_init_alloc_n(a, n, p); }
 142,143c142,143
 < void copy_n_and_update(Allocator &, Iterator, size_type) const
 < { BOOST_ASSERT(false); }
 ---
> void copy_n_and_update(Allocator & a, Iterator n, size_type p) const
> { boost::container::uninitialized_default_init_alloc_n(a, n, p); }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13533>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-04-20 20:18:22 UTC