public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/58415] __sso_string_base move constructor does not null terminate local data when moving from empty string
Date: Fri, 13 Sep 2013 16:59:00 -0000	[thread overview]
Message-ID: <bug-58415-4-DoPpCze6DS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58415-4@http.gcc.gnu.org/bugzilla/>

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-09-13
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Urgh, thanks for your report. The move constructor is wrongly setting the
length "by hand" instead of using _M_set_length, per the below. I'm going to
commit the fix momentarily to mainline and 4_8-branch. Thanks again.

Index: include/ext/sso_string_base.h
===================================================================
--- include/ext/sso_string_base.h       (revision 202561)
+++ include/ext/sso_string_base.h       (working copy)
@@ -362,8 +362,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        }

       _M_length(__rcs._M_length());
-      __rcs._M_length(0);
       __rcs._M_data(__rcs._M_local_data);
+      __rcs._M_set_length(0);
     }
 #endif


  reply	other threads:[~2013-09-13 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 16:16 [Bug libstdc++/58415] New: " mkirzinger at gmail dot com
2013-09-13 16:59 ` paolo.carlini at oracle dot com [this message]
2013-09-13 17:26 ` [Bug libstdc++/58415] " mkirzinger at gmail dot com
2013-09-13 17:29 ` paolo.carlini at oracle dot com
2013-09-13 18:32 ` paolo at gcc dot gnu.org
2013-09-13 18:33 ` paolo at gcc dot gnu.org
2013-09-13 18:34 ` paolo.carlini at oracle dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58415-4-DoPpCze6DS@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).