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


test/bntest.c:165:5: Call
163.           goto err;
164.   
165.       BN_bntest_rand(a, 1024, 1, 0);
           ^
166.       BN_bntest_rand(b, 1024, 1, 0);
167.       BN_copy(c, a);

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->top`
    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:166:5: Call
164.   
165.       BN_bntest_rand(a, 1024, 1, 0);
166.       BN_bntest_rand(b, 1024, 1, 0);
           ^
167.       BN_copy(c, a);
168.       BN_copy(d, b);

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;

crypto/bn/bn_rand.c:29:9: Call
    27.           if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
    28.               goto toosmall;
    29.           BN_zero(rnd);
                  ^
    30.           return 1;
    31.       }

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

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

crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
        658.                            const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
        659.   
        660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
        661.   {
        662.       if (bits > (INT_MAX - BN_BITS2 + 1))

crypto/bn/bn_lcl.h:668:12: Call
        666.           return a;
        667.   
        668.       return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
                          ^
        669.   }
        670.   

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

crypto/bn/bn_lib.c:247:23: Call
          245.   {
          246.       if (words > b->dmax) {
          247.           BN_ULONG *a = bn_expand_internal(b, words);
                                       ^
          248.           if (!a)
          249.               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:231:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bntest_rand` 
            229.       assert(b->top <= words);
            230.       if (b->top > 0)
            231.           memcpy(a, b->d, sizeof(*a) * b->top);
                           ^
            232.   
            233.       return a;
