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


test/bntest.c:382:13: Call
380.       for (i = 0; i < num0 + num1; i++) {
381.           if (i < num1) {
382.               BN_bntest_rand(a, 512, 0, 0);
                   ^
383.               BN_copy(b, a);
384.               if (BN_set_bit(a, i) == 0)

crypto/bn/bn_rand.c:106:1: Parameter `bits`
  104.   }
  105.   
  106. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  107.   {
  108.       return bnrand(2, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:108:12: Call
  106.   int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
  107.   {
  108.       return bnrand(2, rnd, bits, top, bottom);
                    ^
  109.   }
  110.   

crypto/bn/bn_rand.c:56:14: <Offset trace>
54.           unsigned char c;
55.   
56.           for (i = 0; i < bytes; i++) {
                   ^
57.               if (RAND_bytes(&c, 1) <= 0)
58.                   goto err;

crypto/bn/bn_rand.c:56:14: Assignment
    54.           unsigned char c;
    55.   
    56.           for (i = 0; i < bytes; i++) {
                       ^
    57.               if (RAND_bytes(&c, 1) <= 0)
    58.                   goto err;

crypto/bn/bn_rand.c:17:1: <Length trace>
15.   #include <openssl/sha.h>
16.   
17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
18.   {
19.       unsigned char *buf = NULL;

crypto/bn/bn_rand.c:17:1: Parameter `bits`
    15.   #include <openssl/sha.h>
    16.   
    17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
    18.   {
    19.       unsigned char *buf = NULL;

crypto/bn/bn_rand.c:32:5: Assignment
    30.           goto toosmall;
    31.   
    32.       bytes = (bits + 7) / 8;
              ^
    33.       bit = (bits - 1) % 8;
    34.       mask = 0xff << (bit + 1);

crypto/bn/bn_rand.c:36:11: Call
    34.       mask = 0xff << (bit + 1);
    35.   
    36.       buf = OPENSSL_malloc(bytes);
                    ^
    37.       if (buf == NULL) {
    38.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

crypto/mem.c:79:9: Assignment
      77.   
      78.       if (num <= 0)
      79.           return NULL;
                    ^
      80.   
      81.       allow_customize = 0;

crypto/bn/bn_rand.c:36:5: Assignment
    34.       mask = 0xff << (bit + 1);
    35.   
    36.       buf = OPENSSL_malloc(bytes);
              ^
    37.       if (buf == NULL) {
    38.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, 518] Size: [1, 519] by call to `BN_bntest_rand` 
    80.       buf[0] &= ~mask;
    81.       if (bottom)                 /* set bottom bit if requested */
    82.           buf[bytes - 1] |= 1;
                  ^
    83.       if (!BN_bin2bn(buf, bytes, rnd))
    84.           goto err;
