This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/48257] std::string::assign() corrupts std::string static data when called on emptyString1 using emptyString2.data()
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2011 19:39:33 -0000
- Subject: [Bug libstdc++/48257] std::string::assign() corrupts std::string static data when called on emptyString1 using emptyString2.data()
- Auto-submitted: auto-generated
- References: <bug-48257-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48257
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-23 19:39:28 UTC ---
In C++03 see 21.3.5.3 [lib.string.assign] paragraph 6 where
string::assign(const char* s, size_t n) is defined to return
assign( string(s, n) ) and that constructor:
Constructs an object of class basic_string and determines its initial string
value from the array of charT of length n whose first element is designated by
s,
In C++0x the requirement is explicit, [string::assign] paragraph 8 says
Requires: s points to an array of at least n elements of charT.