From: David Asher Date: Mon, 28 Jun 2004 20:16:22 +0000 (+0000) Subject: re PR libstdc++/11352 (crash while internal padding numeric 0) X-Git-Tag: releases/gcc-3.3.5~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5548453e52b807d7282e9aae545ebd2e521de45a;p=thirdparty%2Fgcc.git re PR libstdc++/11352 (crash while internal padding numeric 0) 2004-06-28 David Asher PR libstdc++/11352 * include/bits/locale_facets.tcc (__pad<>::_S_pad): Don't access __olds beyond __oldlen. From-SVN: r83811 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 011cb319c234..ee8545b49d74 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2004-06-28 David Asher + + PR libstdc++/11352 + * include/bits/locale_facets.tcc (__pad<>::_S_pad): Don't + access __olds beyond __oldlen. + 2004-05-31 Release Manager * GCC 3.3.4 Released. diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 641d333fa8a7..2bbf0a48bd02 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -2193,9 +2193,11 @@ namespace std const bool __testsign = _Traits::eq(__olds[0], __minus) || _Traits::eq(__olds[0], __plus); - const bool __testhex = _Traits::eq(__ctype.widen('0'), __olds[0]) - && (_Traits::eq(__ctype.widen('x'), __olds[1]) - || _Traits::eq(__ctype.widen('X'), __olds[1])); + const bool __testhex = (_Traits::eq(__ctype.widen('0'), __olds[0]) + && __oldlen > 1 + && (_Traits::eq(__ctype.widen('x'), __olds[1]) + || _Traits::eq(__ctype.widen('X'), + __olds[1]))); if (__testhex) { __news[0] = __olds[0];