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


crypto/rsa/rsa_gen.c:65:1: Parameter `bits`
63.   }
64.   
65. > static int rsa_builtin_keygen(RSA *rsa, int bits, int primes, BIGNUM *e_value,
66.                                 BN_GENCB *cb)
67.   {

crypto/rsa/rsa_gen.c:105:5: Assignment
103.   
104.       /* divide bits into 'primes' pieces evenly */
105.       quo = bits / primes;
           ^
106.       rmd = bits % primes;
107.   

crypto/rsa/rsa_gen.c:109:20: Assignment
107.   
108.       for (i = 0; i < primes; i++)
109.           bitsr[i] = (i < rmd) ? quo + 1 : quo;
                          ^
110.   
111.       /* We need the RSA components non-NULL */

crypto/rsa/rsa_gen.c:109:9: Assignment
107.   
108.       for (i = 0; i < primes; i++)
109.           bitsr[i] = (i < rmd) ? quo + 1 : quo;
               ^
110.   
111.       /* We need the RSA components non-NULL */

crypto/rsa/rsa_gen.c:170:18: Call
168.           for (;;) {
169.    redo:
170.               if (!BN_generate_prime_ex(prime, bitsr[i] + adj, 0, NULL, NULL, cb))
                        ^
171.                   goto err;
172.               /*

crypto/bn/bn_prime.c:87:1: Parameter `bits`
  85.   }
  86.   
  87. > int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
  88.                            const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb)
  89.   {

crypto/bn/bn_prime.c:121:14: Call
  119.       /* make a random number and set the top and bottom bits */
  120.       if (add == NULL) {
  121.           if (!probable_prime(ret, bits, mods))
                      ^
  122.               goto err;
  123.       } else {

crypto/bn/bn_prime.c:378:1: Parameter `bits`
    376.   }
    377.   
    378. > static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
    379.   {
    380.       int i;

crypto/bn/bn_prime.c:387:10: Call
    385.    again:
    386.       /* TODO: Not all primes are private */
    387.       if (!BN_priv_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
                    ^
    388.           return 0;
    389.       /* we now have a random number 'rnd' to test. */

crypto/bn/bn_rand.c:121:1: Parameter `bits`
      119.   }
      120.   
      121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)
      122.   {
      123.       return bnrand(PRIVATE, rnd, bits, top, bottom, NULL);

crypto/bn/bn_rand.c:123:12: Call
      121.   int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom)
      122.   {
      123.       return bnrand(PRIVATE, rnd, bits, top, bottom, NULL);
                        ^
      124.   }
      125.   

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