summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-22 09:17:51 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-22 09:17:51 +0000
commit8dac76c3a64062bc0b598d5d47c4cc74353b84ca (patch)
tree40af5e26061074674c832fde9f2833e1f01b886d
parent715eed074a8dc2f33ef09816189f56536a07736a (diff)
downloadmpfr-8dac76c3a64062bc0b598d5d47c4cc74353b84ca.tar.gz
[src/vasprintf.c] Fixed the bug in the da_DK locale test: the
computation of the number of characters to be written was incorrect in partition_number() when the thousands separator was not empty. This bug was visible with size = 0 and could be visible near overflow on the number of characters. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11513 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/vasprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vasprintf.c b/src/vasprintf.c
index e709ee07c..075279418 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -1828,7 +1828,7 @@ partition_number (struct number_parts *np, mpfr_srcptr p,
if (np->thousands_sep)
/* ' flag, style f and the thousands separator in current locale is not
reduced to the null character */
- total += (np->ip_size + np->ip_trailing_zeros) / 3;
+ total += (np->ip_size + np->ip_trailing_zeros - 1) / 3;
if (MPFR_UNLIKELY (total < 0 || total > INT_MAX))
goto error;
if (np->point)