This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/81395] [5/6/7/8 Regression] basic_filebuf::overflow recurses and overflows stack
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Jul 2017 11:14:08 +0000
- Subject: [Bug libstdc++/81395] [5/6/7/8 Regression] basic_filebuf::overflow recurses and overflows stack
- Auto-submitted: auto-generated
- References: <bug-81395-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81395
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Hmm, except that if we *do* have a pending output sequence there (i.e. data in
the put area), we'd discard it, losing data. I'll try to verify that with a
testcase.
So we want to avoid getting into a state where we have anything in the put area
while _M_reading is true, which is what comment 2 does.
It looks strange, because usually _M_set_buffer(-1) is used for uncommitted
mode, but what it's actually doing is nuking the buffers. The next read would
need to do an underflow to refill the get area (which is correct), or the next
write would need to do a seek and then an overflow to make a put area available
(which is correct).