PR 72847 Prevent double-free in std::vector<bool>
authorJonathan Wakely <jwakely@redhat.com>
Tue, 16 Aug 2016 11:33:16 +0000 (12:33 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 16 Aug 2016 11:33:16 +0000 (12:33 +0100)
commit32917686b0ebb596fe0d783328a771c4dfd759ef
treebef37ad2a61004e130733c3790b8c0f4d450509c
parentf4eec0a3e34cd709476b5062e44ef0075c75f426
PR 72847 Prevent double-free in std::vector<bool>

PR libstdc++/72847
* include/bits/stl_bvector.h (_Bvector_base::_M_deallocate): Zero
pointers to start and end of storage.
* testsuite/23_containers/vector/bool/72847.cc: New test.
* include/bits/vector.tcc (vector<bool>::_M_reallocate): Only update
_M_finish after deallocating.
(vector<bool>::_M_fill_insert): Likewise.
(vector<bool>::_M_insert_range): Likewise.
(vector<bool>::_M_insert_aux): Likewise.

From-SVN: r239497
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/vector.tcc
libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc [new file with mode: 0644]