crypto/rsa/rsa_gen.c:82: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_generate_prime_ex`.
Showing all 18 steps of the trace


crypto/rsa/rsa_gen.c:39:1: Parameter `bits`
37.   }
38.   
39. > static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
40.                                 BN_GENCB *cb)
41.   {

crypto/rsa/rsa_gen.c:57:5: Assignment
55.           goto err;
56.   
57.       bitsp = (bits + 1) / 2;
          ^
58.       bitsq = bits - bitsp;
59.   

crypto/rsa/rsa_gen.c:82:14: Call
80.       /* generate p and q */
81.       for (;;) {
82.           if (!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb))
                   ^
83.               goto err;
84.           if (!BN_sub(r2, rsa->p, BN_value_one()))

crypto/bn/bn_prime.c:101:1: Parameter `bits`
  99.   }
  100.   
  101. > int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
  102.                            const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb)
  103.   {

crypto/bn/bn_prime.c:135:14: Call
  133.       /* make a random number and set the top and bottom bits */
  134.       if (add == NULL) {
  135.           if (!probable_prime(ret, bits, mods))
                      ^
  136.               goto err;
  137.       } else {

crypto/bn/bn_prime.c:411:1: Parameter `bits`
    409.   }
    410.   
    411. > static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
    412.   {
    413.       int i;

crypto/bn/bn_prime.c:419:10: Call
    417.   
    418.    again:
    419.       if (!BN_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
                    ^
    420.           return (0);
    421.       /* we now have a random number 'rnd' to test. */

crypto/bn/bn_rand.c:96:1: Parameter `bits`
      94.   }
      95.   
      96. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
      97.   {
      98.       return bnrand(0, rnd, bits, top, bottom);

crypto/bn/bn_rand.c:98:12: Call
      96.   int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
      97.   {
      98.       return bnrand(0, rnd, bits, top, bottom);
                        ^
      99.   }
      100.   

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, +oo] Size: [1, +oo] by call to `BN_generate_prime_ex` 
        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;
