Commit d29916b4c598c3561ac77c3aff9a27381b807967

Steffen Jaeckel 2018-12-26T13:16:15

fix missing check of return value

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/bn_mp_prime_is_prime.c b/bn_mp_prime_is_prime.c
index 4915ab8..ce6958a 100644
--- a/bn_mp_prime_is_prime.c
+++ b/bn_mp_prime_is_prime.c
@@ -335,7 +335,9 @@ int mp_prime_is_prime(const mp_int *a, int t, int *result)
          len = mp_count_bits(&b);
          if (len > size_a) {
             len = len - size_a;
-            mp_div_2d(&b, len, &b, NULL);
+            if ((err = mp_div_2d(&b, len, &b, NULL)) != MP_OKAY) {
+               goto LBL_B;
+            }
          }
 
          /* Although the chance for b <= 3 is miniscule, try again. */