From f56d3181a510273c1dadce640072ebdaff3a8e94 Mon Sep 17 00:00:00 2001 From: vlefevre Date: Thu, 16 Jan 2014 13:49:34 +0000 Subject: [src/get_z_exp.c] Added an assert for security in case the precision is large, but the error should be handled properly (to be discussed). Note: there are still corrupt memory problems when the precision is large enough but below the mpz limit (a bug in GMP?). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8752 280ebfd0-de03-0410-8827-d642c229c3f4 --- src/get_z_exp.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/get_z_exp.c b/src/get_z_exp.c index 7c87be356..fb2f5dc91 100644 --- a/src/get_z_exp.c +++ b/src/get_z_exp.c @@ -55,6 +55,10 @@ mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f) fn = MPFR_LIMB_SIZE(f); + /* FIXME: temporary assert for security. Too large values should + probably be handled like infinities. */ + MPFR_ASSERTN (fn <= INT_MAX); /* due to SIZ(z) being an int */ + /* check whether allocated space for z is enough */ mpz_realloc2 (z, (mp_bitcnt_t) fn * GMP_NUMB_BITS); -- cgit v1.2.1