summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2013-12-17 06:37:59 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2013-12-17 06:37:59 +0000
commitea3448d5ec4d565711b2810a08469f816d7e1975 (patch)
tree7246fcb6d2351f8d5ce3e4da8acf90fd26d47b0a
parentafe1eed10464cad7f6d92d4f53baa875a7020fc2 (diff)
downloadmpfr-ea3448d5ec4d565711b2810a08469f816d7e1975.tar.gz
work around for bug in mpn_set_str
(https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8722 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/strtofr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/strtofr.c b/src/strtofr.c
index ed4644dee..fb4cca4e8 100644
--- a/src/strtofr.c
+++ b/src/strtofr.c
@@ -472,8 +472,10 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd)
/* prec bits corresponds to ysize limbs */
ysize_bits = ysize * GMP_NUMB_BITS;
/* and to ysize_bits >= prec > MPFR_PREC (x) bits */
- y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 1);
- y += ysize; /* y has (ysize+1) allocated limbs */
+ /* we need to allocate one more limb to work around bug
+ https://gmplib.org/list-archives/gmp-bugs/2013-December/003267.html */
+ y = MPFR_TMP_LIMBS_ALLOC (2 * ysize + 2);
+ y += ysize; /* y has (ysize+2) allocated limbs */
/* pstr_size is the number of characters we read in pstr->mant
to have at least ysize full limbs.