test/bntest.c:163: error: BUFFER_OVERRUN_L3
  Offset: [-1, 1030] Size: [1, 1031] by call to `BN_bntest_rand`.
Showing all 12 steps of the trace


test/bntest.c:163:11: Call
161.           goto err;
162.   
163.       if (!(TEST_true(BN_bntest_rand(a, 1024, 1, 0))
                 ^
164.               && TEST_true(BN_bntest_rand(b, 1024, 1, 0))
165.               && TEST_ptr(BN_copy(c, a))

crypto/bn/bn_rand.c:111:1: Parameter `bits`
  109.   }
  110.   
  111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  112.   {
  113.       return bnrand(TESTING, rnd, bits, top, bottom, NULL);

crypto/bn/bn_rand.c:113:12: Call
  111.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  112.   {
  113.       return bnrand(TESTING, rnd, bits, top, bottom, NULL);
                    ^
  114.   }
  115.   

crypto/bn/bn_rand.c:62:14: <Offset trace>
60.           unsigned char c;
61.   
62.           for (i = 0; i < bytes; i++) {
                   ^
63.               if (rand_bytes_ex(libctx, &c, 1) <= 0)
64.                   goto err;

crypto/bn/bn_rand.c:62:14: Assignment
    60.           unsigned char c;
    61.   
    62.           for (i = 0; i < bytes; i++) {
                       ^
    63.               if (rand_bytes_ex(libctx, &c, 1) <= 0)
    64.                   goto err;

crypto/bn/bn_rand.c:23:1: <Length trace>
21.   } BNRAND_FLAG;
22.   
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24.                     BN_CTX *ctx)
25.   {

crypto/bn/bn_rand.c:23:1: Parameter `bits`
    21.   } BNRAND_FLAG;
    22.   
    23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
    24.                     BN_CTX *ctx)
    25.   {

crypto/bn/bn_rand.c:39:5: Assignment
    37.           goto toosmall;
    38.   
    39.       bytes = (bits + 7) / 8;
              ^
    40.       bit = (bits - 1) % 8;
    41.       mask = 0xff << (bit + 1);

crypto/bn/bn_rand.c:43:11: Call
    41.       mask = 0xff << (bit + 1);
    42.   
    43.       buf = OPENSSL_malloc(bytes);
                    ^
    44.       if (buf == NULL) {
    45.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

crypto/mem.c:201:9: Assignment
      199.   
      200.       if (num == 0)
      201.           return NULL;
                     ^
      202.   
      203.       FAILTEST();

crypto/bn/bn_rand.c:43:5: Assignment
    41.       mask = 0xff << (bit + 1);
    42.   
    43.       buf = OPENSSL_malloc(bytes);
              ^
    44.       if (buf == NULL) {
    45.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, 1030] Size: [1, 1031] by call to `BN_bntest_rand` 
    86.       buf[0] &= ~mask;
    87.       if (bottom)                 /* set bottom bit if requested */
    88.           buf[bytes - 1] |= 1;
                  ^
    89.       if (!BN_bin2bn(buf, bytes, rnd))
    90.           goto err;
