test/ec_internal_test.c:36: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_pseudo_rand`.
Showing all 16 steps of the trace


test/ec_internal_test.c:36:13: Call
34.           || !TEST_true(BN_is_one(b))
35.           /* (1/a)*a = 1 */
36.           || !TEST_true(BN_pseudo_rand(a, BN_num_bits(group->field) - 1,
                  ^
37.                                        BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))
38.           || !TEST_true(group->meth->field_inv(group, b, a, ctx))

crypto/bn/bn_lib.c:141:9: Assignment
  139.   
  140.       if (BN_is_zero(a))
  141.           return 0;
                 ^
  142.       return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
  143.   }

test/ec_internal_test.c:36:13: Call
34.           || !TEST_true(BN_is_one(b))
35.           /* (1/a)*a = 1 */
36.           || !TEST_true(BN_pseudo_rand(a, BN_num_bits(group->field) - 1,
                  ^
37.                                        BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))
38.           || !TEST_true(group->meth->field_inv(group, b, a, ctx))

crypto/bn/bn_rand.c:187:1: Parameter `bits`
  185.   }
  186.   
  187. > int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
  188.   {
  189.       return BN_rand(rnd, bits, top, bottom);

crypto/bn/bn_rand.c:189:12: Call
  187.   int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
  188.   {
  189.       return BN_rand(rnd, bits, top, bottom);
                    ^
  190.   }
  191.   

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

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

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

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

crypto/bn/bn_rand.c:21:1: <Length trace>
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:21:1: Parameter `bits`
      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:35:5: Assignment
      33.           goto toosmall;
      34.   
      35.       bytes = (bits + 7) / 8;
                ^
      36.       bit = (bits - 1) % 8;
      37.       mask = 0xff << (bit + 1);

crypto/bn/bn_rand.c:39:11: Call
      37.       mask = 0xff << (bit + 1);
      38.   
      39.       buf = OPENSSL_malloc(bytes);
                      ^
      40.       if (buf == NULL) {
      41.           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:39:5: Assignment
      37.       mask = 0xff << (bit + 1);
      38.   
      39.       buf = OPENSSL_malloc(bytes);
                ^
      40.       if (buf == NULL) {
      41.           BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);

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