This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/3141: DR 243: basic_istream::get and getline when sentry reports failure



>Number:         3141
>Category:       libstdc++
>Synopsis:       DR 243: basic_istream::get and getline when sentry reports failure
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 12 10:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     theonetruekenny@yahoo.com
>Release:        20010612 cvs
>Organization:
>Environment:
source
>Description:
see
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#243
>How-To-Repeat:
observe istream::get(char_type* __s, streamsize __n, char_type __delim)
in line 536 of include/bits/istream.tcc

note that on line 573: *__s = char_type(NULL);

observe istream::getline(char_type* __s, streamsize __n, char_type __delim)
in line 627 of include/bits/istream.tcc
note on line 673: *__s = char_type(NULL);
>Fix:
as per DR 243,
i.e.:
before the sentry construction in both the functions, add:
if( __n ) *s == char_type(); // same as charT() as specified in the DR 243

change the existing *__s = char_type(NULL)'s in 573/673 to
*s == char_type(); and move then inside the body of the if's on lines
540 and 631.

The condition in the if() on line 631 should be changed to match that
of the if() on line 540.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]