This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] Fix stringbuf handling of NUL characters
- To: Benjamin Kosnik <bkoz at gnu dot org>
- Subject: Re: [v3] Fix stringbuf handling of NUL characters
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Fri, 13 Jul 2001 16:29:29 -0400
- Cc: libstdc++ at sources dot redhat dot com
- References: <Pine.LNX.4.30.0107121102350.26316-100000@tequila.constant.com>
On Thu, Jul 12, 2001 at 11:04:42AM -0500, Benjamin Kosnik wrote:
>
> Hmm. Can I see a testcase entry for this?
This is a distilled version of what I plan to check in:
1 std::string string_with_nulls ("123 \0 456", 9);
2 std::stringbuf sbuf (string_with_nulls);
sbuf.str().size() should be 9, but right now, it's only 4. The user in
the original bug report was constructing (indirectly) a string like the
one on line 1. But inside istringstream, when we created its stringbuf
with something like line 2, we were allowing a strlen() call to determine
how much data to copy.
Phil
--
Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
- anonymous Egyptian scribe, c.1700 BC