test/bntest.c:2142: error: BUFFER_OVERRUN_L3
  Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 14 steps of the trace


test/bntest.c:2141:17: Call
2139.        */
2140.       if (!TEST_ptr(r = BN_new())
2141.               || !TEST_true(BN_set_word(r, 3))
                        ^
2142.               || !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
2143.                                   0 /* do_trial_division */, NULL), 1)

crypto/bn/bn_lib.c:360:1: Parameter `*a->d`
  358.   }
  359.   
  360. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  361.   {
  362.       bn_check_top(a);

crypto/bn/bn_lib.c:363:9: Call
  361.   {
  362.       bn_check_top(a);
  363.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                 ^
  364.           return 0;
  365.       a->neg = 0;

crypto/bn/bn_lcl.h:651:1: Parameter `*a->d`
    649.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
    650.   
    651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
    652.   {
    653.       if (bits > (INT_MAX - BN_BITS2 + 1))

test/bntest.c:2142:17: Call
2140.       if (!TEST_ptr(r = BN_new())
2141.               || !TEST_true(BN_set_word(r, 3))
2142.               || !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
                        ^
2143.                                   0 /* do_trial_division */, NULL), 1)
2144.               || !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,

crypto/bn/bn_prime.c:151:1: Parameter `*a->d`
  149.   }
  150.   
  151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
  152.                               int do_trial_division, BN_GENCB *cb)
  153.   {

crypto/bn/bn_prime.c:225:13: Call
  223.           /* now 1 <= check < a */
  224.   
  225.           j = witness(check, a, A1, A1_odd, k, ctx, mont);
                     ^
  226.           if (j == -1)
  227.               goto err;

crypto/bn/bn_prime.c:247:1: Parameter `*a->d`
    245.   }
    246.   
    247. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
    248.                      const BIGNUM *a1_odd, int k, BN_CTX *ctx,
    249.                      BN_MONT_CTX *mont)

crypto/bn/bn_prime.c:251:10: Call
    249.                      BN_MONT_CTX *mont)
    250.   {
    251.       if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
                    ^
    252.           return -1;
    253.       if (BN_is_one(w))

crypto/bn/bn_exp.c:393:14: <Offset trace>
391.           /* 2^(top*BN_BITS2) - m */
392.           r->d[0] = (0 - m->d[0]) & BN_MASK2;
393.           for (i = 1; i < j; i++)
                    ^
394.               r->d[i] = (~m->d[i]) & BN_MASK2;
395.           r->top = j;

crypto/bn/bn_exp.c:393:14: Assignment
      391.           /* 2^(top*BN_BITS2) - m */
      392.           r->d[0] = (0 - m->d[0]) & BN_MASK2;
      393.           for (i = 1; i < j; i++)
                          ^
      394.               r->d[i] = (~m->d[i]) & BN_MASK2;
      395.           r->top = j;

crypto/bn/bn_exp.c:296:1: <Length trace>
294.   }
295.   
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297.                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298.   {

crypto/bn/bn_exp.c:296:1: Parameter `*m->d`
      294.   }
      295.   
      296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
      297.                       const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
      298.   {

crypto/bn/bn_exp.c:394:25: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex` 
      392.           r->d[0] = (0 - m->d[0]) & BN_MASK2;
      393.           for (i = 1; i < j; i++)
      394.               r->d[i] = (~m->d[i]) & BN_MASK2;
                                     ^
      395.           r->top = j;
      396.           /*
