summaryrefslogtreecommitdiff
path: root/include/locale
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-02-15 19:19:37 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-02-15 19:19:37 +0000
commitb04ad4162df9080ad93163c0aeb0b7227c465eb3 (patch)
tree2757710589e1622e34f76a765006956aa1dc420c /include/locale
parentd7a2ad6a999094c981b36533cf00b742e71c7916 (diff)
Do not parse sign if a sign is not the next legal character when parsing floating point from an input stream. Fixes http://llvm.org/bugs/show_bug.cgi?id=11871
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/locale')
-rw-r--r--include/locale9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/locale b/include/locale
index a81a63a72..adf8e2f9c 100644
--- a/include/locale
+++ b/include/locale
@@ -665,6 +665,15 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
if (__f >= 32)
return -1;
char __x = __src[__f];
+ if (__x == '-' || __x == '+')
+ {
+ if (__a_end == __a || (__a_end[-1] & 0xDF) == __exp)
+ {
+ *__a_end++ = __x;
+ return 0;
+ }
+ return -1;
+ }
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __x;
if (__x == 'x' || __x == 'X')