test/exptest.c:159: error: BUFFER_OVERRUN_L3
  Offset added: [8, +oo] Size: [0, +oo] by call to `BN_div`.
Showing all 22 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:114:1: Parameter `*rnd->d`
  112.   }
  113.   
  114. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  115.   {
  116.       return bnrand(NORMAL, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:116:12: Call
  114.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  115.   {
  116.       return bnrand(NORMAL, rnd, bits, top, bottom);
                    ^
  117.   }
  118.   

crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d`
    21.   } BNRAND_FLAG;
    22.   
    23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
    24.   {
    25.       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:114:1: Parameter `*rnd->d`
  112.   }
  113.   
  114. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  115.   {
  116.       return bnrand(NORMAL, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:116:12: Call
  114.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
  115.   {
  116.       return bnrand(NORMAL, rnd, bits, top, bottom);
                    ^
  117.   }
  118.   

crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d`
    21.   } BNRAND_FLAG;
    22.   
    23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
    24.   {
    25.       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:209:1: Parameter `*dv->d`
  207.    * If 'dv' or 'rm' is NULL, the respective value is not returned.
  208.    */
  209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
  210.              BN_CTX *ctx)
  211.   {

crypto/bn/bn_div.c:229:11: Call
  227.       }
  228.   
  229.       ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
                   ^
  230.   
  231.       if (ret) {

crypto/bn/bn_div.c:264:1: Parameter `*dv->d`
    262.    *       divisor's length is considered public;
    263.    */
    264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
    265.                        const BIGNUM *divisor, BN_CTX *ctx)
    266.   {

crypto/bn/bn_div.c:327:10: Call
    325.   
    326.       /* Setup quotient */
    327.       if (!bn_wexpand(res, loop))
                    ^
    328.           goto err;
    329.       res->neg = (num->neg ^ divisor->neg);

crypto/bn/bn_lib.c:962:1: Parameter `*a->d`
      960.   }
      961.   
      962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
      963.   {
      964.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:964:37: Call
      962.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
      963.   {
      964.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                                 ^
      965.   }
      966.   

crypto/bn/bn_lib.c:245:1: Parameter `*b->d`
        243.    */
        244.   
        245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
        246.   {
        247.       if (words > b->dmax) {

crypto/bn/bn_lib.c:248:23: Call
        246.   {
        247.       if (words > b->dmax) {
        248.           BN_ULONG *a = bn_expand_internal(b, words);
                                     ^
        249.           if (!a)
        250.               return NULL;

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

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

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

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

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