summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
Diffstat (limited to 'mpi')
-rw-r--r--mpi/mpi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mpi/mpi.c b/mpi/mpi.c
index cb6567a5..178b5fee 100644
--- a/mpi/mpi.c
+++ b/mpi/mpi.c
@@ -2781,7 +2781,7 @@ mp_err mp_bit(mp_int *a, mp_digit bit)
a = &tmp;
}
- return (DIGITS(a)[digit] & mask) != 0 ? MP_YES : MP_NO;
+ return (digit < USED(a) && (DIGITS(a)[digit] & mask) != 0) ? MP_YES : MP_NO;
}
mp_err mp_to_double(mp_int *mp, double *d)