This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/72847] vector<bool> copy-assignment basic exception safety


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72847

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Aug 16 11:33:16 2016
New Revision: 239497

URL: https://gcc.gnu.org/viewcvs?rev=239497&root=gcc&view=rev
Log:
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.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_bvector.h
    trunk/libstdc++-v3/include/bits/vector.tcc

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]