This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/72847] New: vector<bool> copy-assignment basic exception safety
- From: "dyp-cpp at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 08 Aug 2016 20:17:10 +0000
- Subject: [Bug libstdc++/72847] New: vector<bool> copy-assignment basic exception safety
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72847
Bug ID: 72847
Summary: vector<bool> copy-assignment basic exception safety
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: dyp-cpp at gmx dot net
Target Milestone: ---
vector<bool>'s copy-assignment operator uses a very simple algorithm if
resizing is required: first, free the current allocation, then create a new
allocation. The pointer data member that holds the allocation is not touched by
the first step, then assigned-to by the second step. Therefore, if the second
step (the allocation) fails via exception, that pointer (_M_end_of_storage -
size()) is dangling. Destruction of a vector<bool> in such a state leads to a
double deletion.