This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/38476] SIGSEGV on istream::read() in unbuffered mode
- From: "sebor at roguewave dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Dec 2008 20:08:01 -0000
- Subject: [Bug libstdc++/38476] SIGSEGV on istream::read() in unbuffered mode
- References: <bug-38476-1186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from sebor at roguewave dot com 2008-12-30 20:08 -------
Quoting [lib.istream], p2:
Both [formatted and unformatted] input functions are described as if
they obtain (or extract) input characters by calling rdbuf()->sbumpc()
or rdbuf()->sgetc(). They may use other public members of istream.
sgetc() is required to return the result of underflow(), while sbumpc()
is required to return the result of uflow() (there's no requirement to
actually call either of these virtual functions, i.e., no Effects clause,
but that's a defect in the spec). The submitted test case assumes that
read() calls rdbuf()->sgetc() rather than sbumpc() which could be argued
makes it invalid.
An implementation of istream::read() may call streambuf::xsgetn() but it
must avoid calling an xsgetn() overridden in a derived class. Let me open
a separate issue for this.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38476