From 8dac76c3a64062bc0b598d5d47c4cc74353b84ca Mon Sep 17 00:00:00 2001 From: vlefevre Date: Mon, 22 May 2017 09:17:51 +0000 Subject: [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 --- src/vasprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit v1.2.1