diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-16 13:49:34 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-16 13:49:34 +0000 |
commit | f56d3181a510273c1dadce640072ebdaff3a8e94 (patch) | |
tree | 3221a230eb510d2d101abc564bcdb556645adefd | |
parent | d4a6d4fce6d302077c028f13b70572fc541b3972 (diff) | |
download | mpfr-f56d3181a510273c1dadce640072ebdaff3a8e94.tar.gz |
[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
-rw-r--r-- | src/get_z_exp.c | 4 |
1 files changed, 4 insertions, 0 deletions
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); |