mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 22:14:26 +02:00
Fix invalid multiallocation_chain iterator increment after memory was overwritten.
This commit is contained in:
@@ -349,10 +349,11 @@ struct node_alloc_holder
|
|||||||
dtl::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
|
dtl::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
|
||||||
while(n){
|
while(n){
|
||||||
--n;
|
--n;
|
||||||
|
p = boost::movelib::iterator_to_raw_pointer(itbeg);
|
||||||
|
++itbeg; //Increment iterator before overwriting pointed memory
|
||||||
//This does not throw
|
//This does not throw
|
||||||
p = ::new(boost::movelib::iterator_to_raw_pointer(itbeg), boost_container_new_t()) Node;
|
p = ::new(p, boost_container_new_t()) Node;
|
||||||
node_deallocator.set(p);
|
node_deallocator.set(p);
|
||||||
++itbeg;
|
|
||||||
//This can throw
|
//This can throw
|
||||||
boost::container::construct_in_place(nalloc, p->get_real_data_ptr(), beg);
|
boost::container::construct_in_place(nalloc, p->get_real_data_ptr(), beg);
|
||||||
sdestructor.set(p);
|
sdestructor.set(p);
|
||||||
|
Reference in New Issue
Block a user