Bug 64211 - stringbuf::underflow causes an infinite loop
stringbuf::underflow causes an infinite loop
Status: CLOSED NEXTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: libstdc++ (Show other bugs)
7.2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-04-29 08:13 EDT by Pavel Tsekov
Modified: 2007-04-18 12:42 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-05 12:34:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
The simple patch I've used to solve the problem (611 bytes, patch)
2002-05-01 07:11 EDT, Pavel Tsekov
no flags Details | Diff

  None (edit)
Description Pavel Tsekov 2002-04-29 08:13:04 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Description of problem:
The following sample compiled with the libstdc++ coming with gcc 2.96-98 
results in an infinite loop:

char buf[2048];
stringstream s;
s.write (buf, 2048);
s.seekg (0, ios::beg);
s.read (buf, 2048);

The reason for this is that the get/put pointers are not set in the default 
constructor of the stringbuf class.

To fix this one needs to set the get/put pointers as it is done in the other 
stringbuf constructor - the one acception string.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
See the description.

Actual Results:  Infinite loop.

Expected Results:  Data should be read in the buffer.

Additional info:
Comment 1 Pavel Tsekov 2002-05-01 07:11:13 EDT
Created attachment 56024 [details]
The simple patch I've used to solve the problem
Comment 2 Pavel Tsekov 2002-05-01 16:22:34 EDT
I realize the 'Short Summary' is somewhat incorrect - a more approapriate one 
would be - "read () on a stringstream causes an infinite loop". Sorry for the 
inconvinience.
Comment 3 Pavel Tsekov 2002-05-20 05:10:32 EDT
Any chance this matter to be reviewed anytime soon ?
Comment 4 Benjamin Kosnik 2004-10-05 12:34:21 EDT
Fixed 3.2.x, 3.3.x, 4.0.x

Note You need to log in before you can comment on or make changes to this bug.