public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9988: filebuf::overflow writes EOF to file
@ 2003-03-09 22:01 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-03-09 22:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, peturr02

Synopsis: filebuf::overflow writes EOF to file

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Sun Mar  9 22:01:47 2003
State-Changed-Why:
    Fixed for 3.3 and 3.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9988


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/9988: filebuf::overflow writes EOF to file
@ 2003-03-09 20:05 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-03-09 20:05 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, peturr02

Synopsis: filebuf::overflow writes EOF to file

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Mar  9 20:05:11 2003
Responsible-Changed-Why:
    Patching.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Mar  9 20:05:11 2003
State-Changed-Why:
    Confirmed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9988


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/9988: filebuf::overflow writes EOF to file
@ 2003-03-07 11:26 peturr02
  0 siblings, 0 replies; 3+ messages in thread
From: peturr02 @ 2003-03-07 11:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9988
>Category:       libstdc++
>Synopsis:       filebuf::overflow writes EOF to file
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 07 11:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
If the parameter passed to filebuf::overflow equals traits_type::eof() it is written to the file.
>How-To-Repeat:
See attachment.
>Fix:
Check for EOF before writing character.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="overflowbug.cc"
Content-Disposition: inline; filename="overflowbug.cc"

#include <fstream>

#undef NDEBUG
#include <cassert>

class Buf : public std::filebuf
{
public:
	int_type pub_overflow(int_type c = traits_type::eof())
		{ return std::filebuf::overflow(c); }
};

int main()
{
	using namespace std;

	Buf fb;
	fb.open("tmp", ios_base::out);

	fb.sputc('a');
	fb.pub_overflow('b');
	fb.pub_overflow();
	fb.sputc('c');
	fb.close();

	filebuf fbin;
	fbin.open("tmp", ios_base::in);
	int c;
	c = fbin.sbumpc();
	assert(c == 'a');
	c = fbin.sbumpc();
	assert(c == 'b');
	c = fbin.sbumpc();
	assert(c == 'c');
	c = fbin.sbumpc();
	assert(c == filebuf::traits_type::eof());
	fbin.close();

	return 0;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-09 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-09 22:01 libstdc++/9988: filebuf::overflow writes EOF to file paolo
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09 20:05 paolo
2003-03-07 11:26 peturr02

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