diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-07-01 10:49:04 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-07-01 10:49:04 +0000 |
commit | 577e1e921222daa82313f54f29c424df4f005a81 (patch) | |
tree | d9882e6a26e649d240b830d9386559785c7bfcb0 /round_prec.c | |
parent | 5ddff162afbddceacb1541e351a089d9d50863a2 (diff) | |
download | mpfr-577e1e921222daa82313f54f29c424df4f005a81.tar.gz |
fixed Uninitialized memory read in mpfr_can_round
(when b is NaN or Inf)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2378 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'round_prec.c')
-rw-r--r-- | round_prec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/round_prec.c b/round_prec.c index 2a0a191b9..b9d75231c 100644 --- a/round_prec.c +++ b/round_prec.c @@ -225,10 +225,12 @@ int mpfr_can_round (mpfr_ptr b, mp_exp_t err, mp_rnd_t rnd1, mp_rnd_t rnd2, mp_prec_t prec) { - return MPFR_IS_ZERO(b) ? 0 : /* we cannot round if b=0 */ - mpfr_can_round_raw (MPFR_MANT(b), - (MPFR_PREC(b) - 1)/BITS_PER_MP_LIMB + 1, - MPFR_SIGN(b), err, rnd1, rnd2, prec); + return MPFR_IS_FP(b) ? + (MPFR_IS_ZERO(b) ? 0 : /* we cannot round if b=0 */ + mpfr_can_round_raw (MPFR_MANT(b), + (MPFR_PREC(b) - 1)/BITS_PER_MP_LIMB + 1, + MPFR_SIGN(b), err, rnd1, rnd2, prec)) + : 1; /* can always round NaN or Inf */ } int |