Red Hat Bugzilla – Bug 64211
stringbuf::underflow causes an infinite loop
Last modified: 2007-04-18 12:42:21 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:
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):
Steps to Reproduce:
See the description.
Actual Results: Infinite loop.
Expected Results: Data should be read in the buffer.
Created attachment 56024 [details]
The simple patch I've used to solve the problem
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
Any chance this matter to be reviewed anytime soon ?
Fixed 3.2.x, 3.3.x, 4.0.x