crypto/rand/rand_lib.c:157: error: BUFFER_OVERRUN_L3
  Offset added: [0, 15] Size: [0, +oo] by call to `RAND_DRBG_generate`.
Showing all 9 steps of the trace


crypto/rand/rand_lib.c:141:1: Parameter `min_len`
139.   }
140.   
141. > size_t drbg_entropy_from_parent(RAND_DRBG *drbg,
142.                                   unsigned char **pout,
143.                                   int entropy, size_t min_len, size_t max_len)

crypto/rand/rand_lib.c:157:10: Call
155.   
156.       /* Get random from parent, include our state as additional input. */
157.       st = RAND_DRBG_generate(drbg->parent, randomness, min_len, 0,
                ^
158.                               (unsigned char *)drbg, sizeof(*drbg));
159.       if (st == 0) {

crypto/rand/drbg_lib.c:236:1: Parameter `outlen`
  234.    * sent in |adin| and |adinlen|.
  235.    */
  236. > int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,
  237.                          int prediction_resistance,
  238.                          const unsigned char *adin, size_t adinlen)

crypto/rand/drbg_lib.c:274:10: Call
  272.       }
  273.   
  274.       if (!ctr_generate(drbg, out, outlen, adin, adinlen)) {
                  ^
  275.           drbg->state = DRBG_ERROR;
  276.           RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_GENERATE_ERROR);

crypto/rand/drbg_rand.c:266:1: <Offset trace>
264.   }
265.   
266. > int ctr_generate(RAND_DRBG *drbg,
267.                    unsigned char *out, size_t outlen,
268.                    const unsigned char *adin, size_t adinlen)

crypto/rand/drbg_rand.c:266:1: Parameter `outlen`
    264.   }
    265.   
    266. > int ctr_generate(RAND_DRBG *drbg,
    267.                    unsigned char *out, size_t outlen,
    268.                    const unsigned char *adin, size_t adinlen)

crypto/rand/drbg_rand.c:266:1: <Length trace>
264.   }
265.   
266. > int ctr_generate(RAND_DRBG *drbg,
267.                    unsigned char *out, size_t outlen,
268.                    const unsigned char *adin, size_t adinlen)

crypto/rand/drbg_rand.c:266:1: Parameter `drbg->ctr.K[*]`
    264.   }
    265.   
    266. > int ctr_generate(RAND_DRBG *drbg,
    267.                    unsigned char *out, size_t outlen,
    268.                    const unsigned char *adin, size_t adinlen)

crypto/rand/drbg_rand.c:288:13: Array access: Offset added: [0, 15] Size: [0, +oo] by call to `RAND_DRBG_generate` 
    286.               /* Use K as temp space as it will be updated */
    287.               AES_encrypt(ctr->V, ctr->K, &ctr->ks);
    288.               memcpy(out, ctr->K, outlen);
                       ^
    289.               break;
    290.           }

int ctr_generate(RAND_DRBG *drbg,
                 unsigned char *out, size_t outlen,
                 const unsigned char *adin, size_t adinlen)
{
    RAND_DRBG_CTR *ctr = &drbg->ctr;
    if (adin != NULL && adinlen != 0) {
        ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0);
        if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
            adin = NULL;
            adinlen = 1;
        }
    } else {
        adinlen = 0;
    }
    for ( ; ; ) {
        inc_128(ctr);
        if (outlen < 16) {
            AES_encrypt(ctr->V, ctr->K, &ctr->ks);
            memcpy(out, ctr->K, outlen);
            break;
        }
        AES_encrypt(ctr->V, out, &ctr->ks);
        out += 16;
        outlen -= 16;
        if (outlen == 0)
            break;
    }
    ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0);
    return 1;
}
['size_t drbg_entropy_from_parent(RAND_DRBG *drbg,\n                                unsigned char **pout,\n                                int entropy, size_t min_len, size_t max_len)\n{\n    int st;\n    unsigned char *randomness;\n    if (min_len > (size_t)drbg->size) {\n        min_len = drbg->size;\n    }\n    randomness = drbg->secure ? OPENSSL_secure_malloc(drbg->size)\n                                    : OPENSSL_malloc(drbg->size);\n    st = RAND_DRBG_generate(drbg->parent, randomness, min_len, 0,\n                            (unsigned char *)drbg, sizeof(*drbg));\n    if (st == 0) {\n        drbg_release_entropy(drbg, randomness, min_len);\n        return 0;\n    }\n    *pout = randomness;\n    return min_len;\n}', 'int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,\n                       int prediction_resistance,\n                       const unsigned char *adin, size_t adinlen)\n{\n    if (drbg->state == DRBG_ERROR) {\n        RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_IN_ERROR_STATE);\n        return 0;\n    }\n    if (drbg->state == DRBG_UNINITIALISED) {\n        RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_NOT_INSTANTIATED);\n        return 0;\n    }\n    if (outlen > drbg->max_request) {\n        RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_REQUEST_TOO_LARGE_FOR_DRBG);\n        return 0;\n    }\n    if (adinlen > drbg->max_adinlen) {\n        RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_ADDITIONAL_INPUT_TOO_LONG);\n        return 0;\n    }\n    if (drbg->fork_count != rand_fork_count) {\n        drbg->fork_count = rand_fork_count;\n        drbg->state = DRBG_RESEED;\n    }\n    if (drbg->reseed_counter >= drbg->reseed_interval)\n        drbg->state = DRBG_RESEED;\n    if (drbg->state == DRBG_RESEED || prediction_resistance) {\n        if (!RAND_DRBG_reseed(drbg, adin, adinlen)) {\n            RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_RESEED_ERROR);\n            return 0;\n        }\n        adin = NULL;\n        adinlen = 0;\n    }\n    if (!ctr_generate(drbg, out, outlen, adin, adinlen)) {\n        drbg->state = DRBG_ERROR;\n        RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_GENERATE_ERROR);\n        return 0;\n    }\n    if (drbg->reseed_counter >= drbg->reseed_interval)\n        drbg->state = DRBG_RESEED;\n    else\n        drbg->reseed_counter++;\n    return 1;\n}', 'int ctr_generate(RAND_DRBG *drbg,\n                 unsigned char *out, size_t outlen,\n                 const unsigned char *adin, size_t adinlen)\n{\n    RAND_DRBG_CTR *ctr = &drbg->ctr;\n    if (adin != NULL && adinlen != 0) {\n        ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0);\n        if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {\n            adin = NULL;\n            adinlen = 1;\n        }\n    } else {\n        adinlen = 0;\n    }\n    for ( ; ; ) {\n        inc_128(ctr);\n        if (outlen < 16) {\n            AES_encrypt(ctr->V, ctr->K, &ctr->ks);\n            memcpy(out, ctr->K, outlen);\n            break;\n        }\n        AES_encrypt(ctr->V, out, &ctr->ks);\n        out += 16;\n        outlen -= 16;\n        if (outlen == 0)\n            break;\n    }\n    ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0);\n    return 1;\n}']