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++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 14:15:58 UTC ---
Jon, didn't we somehow discuss this issue already, in a slightly different form
(the issue of course was less evident pre that fix)? Thus, if I remember
correctly what I was thinking at that time, a good general and safe fix would
be tweaking a bit _M_disjunct, making it more careful so to speak, thus
considering the address of the source as overlapping also if it corresponds to
the '\0' at the end of destination. The philosophy in other terms is
"preserving" the whole internal buffer, thus '\0' included. Matter of adding a
+ 1 somewhere, in other terms ;) If my analysis is correct, the fix would work
as a special case for the test here involving empty reps, and I think it's the
safe fix we want for the current std::string implementation at this stage.


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