public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: david@hedbor.org To: gcc-gnats@gcc.gnu.org Cc: grendel@caudium.net Subject: libstdc++/4083: input stream with field width() set reads too much to std::string Date: Wed, 22 Aug 2001 12:26:00 -0000 [thread overview] Message-ID: <20010822192201.25079.qmail@sourceware.cygnus.com> (raw) >Number: 4083 >Category: libstdc++ >Synopsis: input stream with field width() set reads too much to std::string >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Aug 22 12:26:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: David Hedbor >Release: 3.0.1 >Organization: >Environment: Mandrake Cooker linux install, glibc 2.2.3 >Description: When I set the width of an input stream and when use operator >> to an std::string, one byte too many is read. I.e "ifs.width(8); ifs >> str;" reads 8 bytes if str is an std::string but 7 bytes if it's a char *. gcc 2.96 (mandrake) and egcs-2.91.66 do now show this problem. >How-To-Repeat: Compile and run the attached program. >Fix: Unknown. A workaround is to use a temporary char * for reading into. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.cpp" I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxjc3RkaW8+Cgov LyBCdWcgaXMgdGhhdCA+PiB0byBhIHN0ZDo6c3RyaW5nLCB3aXRoIHdpZHRoKCkgc2V0LCByZWFk cyBvbmUgdG9vIG1hbnkgYnl0ZXMuIAppbnQgbWFpbigpIHsKICBzdGQ6OnN0cmluZyBzdHI7CiAg Y2hhciBzdHIyWzhdOwogIHN0ZDo6aWZzdHJlYW0gaWZzKCJ0ZXN0LmNwcCIsIHN0ZDo6aW9zOjpp bik7CiAgaWZzLndpZHRoKDgpOwogIGlmcyA+PiBzdHI7CiAgc3RkOjppZnN0cmVhbSBpZnMyKCJ0 ZXN0LmNwcCIsIHN0ZDo6aW9zOjppbik7CiAgaWZzMi53aWR0aCg4KTsKICBpZnMyID4+IHN0cjI7 CiAgcHJpbnRmKCJzdHIubGVuZ3RoKCkgPSAlZCwgc3RybGVuKHN0ci5jX3N0cigpKSA9ICVkXG5z dHJsZW4oc3RyMikgPT0gJWRcbiIsCgkgc3RyLmxlbmd0aCgpLCBzdHJsZW4oc3RyLmNfc3RyKCkp LCBzdHJsZW4oc3RyMikpOwp9Cg==
next reply other threads:[~2001-08-22 12:26 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-08-22 12:26 david [this message] 2001-08-24 12:07 bkoz 2001-08-24 12:19 bkoz 2001-08-24 12:26 David Hedbor 2001-08-24 12:26 Benjamin Kosnik
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=20010822192201.25079.qmail@sourceware.cygnus.com \ --to=david@hedbor.org \ --cc=gcc-gnats@gcc.gnu.org \ --cc=grendel@caudium.net \ /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: linkBe 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).