test/exptest.c:159: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, +oo] by call to `BN_div`.
Showing all 20 steps of the trace


test/exptest.c:149:5: Call
147.       RAND_bytes(&c, 1);
148.       c = (c % BN_BITS) - BN_BITS2;
149.       BN_rand(a, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY);
           ^
150.   
151.       RAND_bytes(&c, 1);

crypto/bn/bn_rand.c:97:1: Parameter `*rnd->d`
  95.   }
  96.   
  97. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  98.   {
  99.       return bnrand(NORMAL, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:99:12: Call
  97.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  98.   {
  99.       return bnrand(NORMAL, rnd, bits, top, bottom);
                    ^
  100.   }
  101.   

crypto/bn/bn_rand.c:21:1: Parameter `*rnd->d`
    19.   } BNRAND_FLAG;
    20.   
    21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
    22.   {
    23.       unsigned char *buf = NULL;

test/exptest.c:157:5: Call
155.       RAND_bytes(&c, 1);
156.       c = (c % BN_BITS) - BN_BITS2;
157.       BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
           ^
158.   
159.       if (!TEST_true(BN_mod(a, a, m, ctx))

crypto/bn/bn_rand.c:97:1: Parameter `*rnd->d`
  95.   }
  96.   
  97. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  98.   {
  99.       return bnrand(NORMAL, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:99:12: Call
  97.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  98.   {
  99.       return bnrand(NORMAL, rnd, bits, top, bottom);
                    ^
  100.   }
  101.   

crypto/bn/bn_rand.c:21:1: Parameter `*rnd->d`
    19.   } BNRAND_FLAG;
    20.   
    21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
    22.   {
    23.       unsigned char *buf = NULL;

test/exptest.c:159:10: Call
157.       BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
158.   
159.       if (!TEST_true(BN_mod(a, a, m, ctx))
                ^
160.           || !TEST_true(BN_mod(b, b, m, ctx))
161.           || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL))

crypto/bn/bn_div.c:137:1: Parameter `*dv->d`
  135.    * If 'dv' or 'rm' is NULL, the respective value is not returned.
  136.    */
  137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
  138.              BN_CTX *ctx)
  139.   {

crypto/bn/bn_div.c:251:10: Call
  249.   
  250.       /* Setup to 'res' */
  251.       if (!bn_wexpand(res, (loop + 1)))
                  ^
  252.           goto err;
  253.       res->neg = (num->neg ^ divisor->neg);

crypto/bn/bn_lib.c:940:1: Parameter `*a->d`
    938.   }
    939.   
    940. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
    941.   {
    942.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:942:37: Call
    940.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
    941.   {
    942.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                               ^
    943.   }
    944.   

crypto/bn/bn_lib.c:273:1: Parameter `*b->d`
      271.    */
      272.   
      273. > BIGNUM *bn_expand2(BIGNUM *b, int words)
      274.   {
      275.       bn_check_top(b);

crypto/bn/bn_lib.c:278:23: Call
      276.   
      277.       if (words > b->dmax) {
      278.           BN_ULONG *a = bn_expand_internal(b, words);
                                   ^
      279.           if (!a)
      280.               return NULL;

crypto/bn/bn_lib.c:235:1: <Offset trace>
233.   /* This is used by bn_expand2() */
234.   /* The caller MUST check that words > b->dmax before calling this */
235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
236.   {
237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: Parameter `b->top`
        233.   /* This is used by bn_expand2() */
        234.   /* The caller MUST check that words > b->dmax before calling this */
        235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
        236.   {
        237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: <Length trace>
233.   /* This is used by bn_expand2() */
234.   /* The caller MUST check that words > b->dmax before calling this */
235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
236.   {
237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:235:1: Parameter `*b->d`
        233.   /* This is used by bn_expand2() */
        234.   /* The caller MUST check that words > b->dmax before calling this */
        235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
        236.   {
        237.       BN_ULONG *a = NULL;

crypto/bn/bn_lib.c:260:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_div` 
        258.       assert(b->top <= words);
        259.       if (b->top > 0)
        260.           memcpy(a, b->d, sizeof(*a) * b->top);
                       ^
        261.   
        262.       return a;
