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


test/bntest.c:247:5: Call
245.           goto err;
246.   
247.       BN_bntest_rand(a, 1024, 0, 0);
           ^
248.       for (i = 0; i < NUM0; i++) {
249.           BN_bntest_rand(b, 450 + i * 10, 0, 0);

crypto/bn/bn_rand.c:102:1: Parameter `*rnd->d`
  100.   }
  101.   
  102. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:104:12: Call
  102.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
                    ^
  105.   }
  106.   

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/bntest.c:249:9: Call
247.       BN_bntest_rand(a, 1024, 0, 0);
248.       for (i = 0; i < NUM0; i++) {
249.           BN_bntest_rand(b, 450 + i * 10, 0, 0);
               ^
250.           BN_set_negative(a, rand_neg());
251.           BN_set_negative(b, rand_neg());

crypto/bn/bn_rand.c:102:1: Parameter `*rnd->d`
  100.   }
  101.   
  102. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:104:12: Call
  102.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  103.   {
  104.       return bnrand(TESTING, rnd, bits, top, bottom);
                    ^
  105.   }
  106.   

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/bntest.c:252:9: Call
250.           BN_set_negative(a, rand_neg());
251.           BN_set_negative(b, rand_neg());
252.           BN_mod(c, a, b, ctx);
               ^
253.           BN_div(d, e, a, b, ctx);
254.           BN_sub(e, e, c);

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:910:1: Parameter `*a->d`
    908.   }
    909.   
    910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
    911.   {
    912.       return (words <= a->dmax) ? a : bn_expand2(a, words);

crypto/bn/bn_lib.c:912:37: Call
    910.   BIGNUM *bn_wexpand(BIGNUM *a, int words)
    911.   {
    912.       return (words <= a->dmax) ? a : bn_expand2(a, words);
                                               ^
    913.   }
    914.   

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

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

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

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

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

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

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