From 5548453e52b807d7282e9aae545ebd2e521de45a Mon Sep 17 00:00:00 2001 From: David Asher Date: Mon, 28 Jun 2004 20:16:22 +0000 Subject: [PATCH] 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 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/locale_facets.tcc | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) 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]; -- 2.47.2