[Bug libstdc++/11460] New: Incorrect use of int_type in strstreambuf::pbackfail
peturr02 at ru dot is
gcc-bugzilla@gcc.gnu.org
Tue Jul 8 09:15:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11460
Summary: Incorrect use of int_type in strstreambuf::pbackfail
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
strstreambuf::pbackfail uses the construct
else if (c == static_cast<int_type>(gptr()[-1]))
where c is of type int_type. This always evaluates to false when
gptr()[-1] < 0, since values of int_type that correspond to actual
characters are >= 0. To fix, this should be changed to
else if (c == static_cast<unsigned char>(gptr()[-1]))
or, even better
else if (c == traits_type::to_int_type(gptr()[-1]))
More information about the Gcc-bugs
mailing list