🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gnu.g++.lib.bug
1 messages
1 total messages Started by Frank Breure . Thu, 16 Apr 1992 15:03
core dump if writing more than 8192 bytes to cerr
#97
Author: Frank Breure .
Date: Thu, 16 Apr 1992 15:03
58 lines
2499 bytes
Hello,

I noticed the following bug:

If writing more than 8192 characters to cerr, doesn't matter in how
many different small chunks, you get a segmentation violation.
Gdb says it's in filebuf:overflow() or streambuf::pptr() this depends
whether it is compiled with -g.

I saw this problem on both installations I have:
using:

libg++ version 2.0
gcc 2.0

on:
Sun Sparc station with SunOs 4.1.1
DECstation 5000 with Ultrix 4.2

I made the following patch which works for me, but I don't think
I really fixed the bug. 
It is probably only a workaround.


------ begin of patch -----
*** libg++/iostream/stdstreams.C	Thu Apr 16 12:04:32 1992
--- libg++/iostream/stdstreams.C~	Thu Apr  2 16:02:12 1992
***************
*** 62,72 ****
   (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::skipws|EXTRA_FLAGS, ' ', 0, 6
  
  STR_NAME(_fake_ostream, cout)  = { STD_STR(_cout_sbuf, NULL, 0) };
- // changed by Frank Breure because of an annoying bug in writing to
- // cerr which made it impossible to write more than 8192 (== ios::unitbuf)
- // to cerr !!
  STR_NAME(_fake_ostream, cerr) =
!   { STD_STR(_cerr_sbuf, (ostream*)&cout, 0) };
  STR_NAME(_fake_istream, cin)  = { STD_STR(_cin_sbuf,  (ostream*)&cout, 0) };
  
  /* Only for (partial) compatibility with AT&T's library. */
--- 62,69 ----
   (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::skipws|EXTRA_FLAGS, ' ', 0, 6
  
  STR_NAME(_fake_ostream, cout)  = { STD_STR(_cout_sbuf, NULL, 0) };
  STR_NAME(_fake_ostream, cerr) =
!   { STD_STR(_cerr_sbuf, (ostream*)&cout, ios::unitbuf) };
  STR_NAME(_fake_istream, cin)  = { STD_STR(_cin_sbuf,  (ostream*)&cout, 0) };
  
  /* Only for (partial) compatibility with AT&T's library. */
---- end of patch ----

I hope this is of some help for you,

--
Frank Breure                                       (breure@iti.tno.nl)
TNO Institute of Applied Computer Science       Delft, The Netherlands
----------------------------------------------------------------------
My opinions may be subject to change without notice.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads