Bug 64211 - stringbuf::underflow causes an infinite loop
Summary: stringbuf::underflow causes an infinite loop
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libstdc++
Version: 7.2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-04-29 12:13 UTC by Pavel Tsekov
Modified: 2007-04-18 16:42 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-05 16:34:21 UTC
Embargoed:


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

Description Pavel Tsekov 2002-04-29 12:13:04 UTC
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 11:11:13 UTC
Created attachment 56024 [details]
The simple patch I've used to solve the problem

Comment 2 Pavel Tsekov 2002-05-01 20:22:34 UTC
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 09:10:32 UTC
Any chance this matter to be reviewed anytime soon ?

Comment 4 Benjamin Kosnik 2004-10-05 16:34:21 UTC
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.