Root/toolchain/gcc/patches/4.2.4/307-locale_facets.patch

1This patch fixes a bug into ostream::operator<<(double) due to the wrong size
2passed into the __convert_from_v method. The wrong size is then passed to
3std::snprintf function, that, on uClibc, doens't handle sized 0 buffer.
4
5Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
6
7Index: gcc-4.2.3/libstdc++-v3/include/bits/locale_facets.tcc
8===================================================================
9--- gcc-4.2.3.orig/libstdc++-v3/include/bits/locale_facets.tcc 2008-01-05 12:04:43.000000000 +0100
10+++ gcc-4.2.3/libstdc++-v3/include/bits/locale_facets.tcc 2008-05-21 13:45:51.877288338 +0200
11@@ -1145,7 +1145,7 @@
12     const int __cs_size = __fixed ? __max_exp + __prec + 4
13                                   : __max_digits * 2 + __prec;
14     char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
15- __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf,
16+ __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, __fbuf,
17                       __prec, __v);
18 #endif
19 
20@@ -1779,7 +1779,7 @@
21       // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'.
22       const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;
23       char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));
24- int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf",
25+ int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, "%.*Lf",
26                     0, __units);
27 #endif
28       string_type __digits(__len, char_type());
29

Archive Download this file



interactive