]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/11352 (crash while internal padding numeric 0)
authorDavid Asher <david.asher@cavium.com>
Mon, 28 Jun 2004 20:16:22 +0000 (20:16 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 28 Jun 2004 20:16:22 +0000 (20:16 +0000)
2004-06-28  David Asher  <david.asher@cavium.com>

PR libstdc++/11352
* include/bits/locale_facets.tcc (__pad<>::_S_pad): Don't
access __olds beyond __oldlen.

From-SVN: r83811

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/locale_facets.tcc

index 011cb319c2345889dd7c9436d2a16f6417f97a07..ee8545b49d74ae1a4696d3e7c7f5a74eed81599b 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-28  David Asher  <david.asher@cavium.com>
+
+       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.
index 641d333fa8a732e74d659e5d2a620b1d4e98851b..2bbf0a48bd023abb159de6b65d8232c741526d17 100644 (file)
@@ -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];