summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/locale.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 00eb574ec45..ca0a1c9b15f 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -4379,7 +4379,9 @@ void
__check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
ios_base::iostate& __err)
{
- if (__grouping.size() != 0)
+// if the grouping pattern is empty _or_ there are no grouping bits, then do nothing
+// we always have at least a single entry in [__g, __g_end); the end of the input sequence
+ if (__grouping.size() >= 0 && __g_end - __g > 1)
{
reverse(__g, __g_end);
const char* __ig = __grouping.data();
OpenPOWER on IntegriCloud