math/mp-arith.c (mp_testbit): Want nonstrict comparison for bounds check.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 3 Jun 2016 21:25:02 +0000 (22:25 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 4 Jun 2016 00:05:47 +0000 (01:05 +0100)
math/mp-arith.c

index 2d7d635..61780b0 100644 (file)
@@ -116,7 +116,7 @@ mp *mp_lsr2c(mp *d, mp *a, size_t n)
 
 int mp_testbit(mp *x, unsigned long n)
 {
-  if (n > MPW_BITS * MP_LEN(x))
+  if (n >= MPW_BITS * MP_LEN(x))
     return (0);
   return ((x->v[n/MPW_BITS] >> n%MPW_BITS) & 1u);
 }