This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/38476] SIGSEGV on istream::read() in unbuffered mode



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]