[Bug libstdc++/38476] SIGSEGV on istream::read() in unbuffered mode
sebor at roguewave dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 30 20:09:00 GMT 2008
------- 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
More information about the Gcc-bugs
mailing list