providers/fips/fipsprov.c:144: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 8 steps of the trace


providers/fips/fipsprov.c:125:5: Call
123.       if (bnctx == NULL)
124.           goto err;
125.       BN_CTX_start(bnctx);
           ^
126.       a = BN_CTX_get(bnctx);
127.       b = BN_CTX_get(bnctx);

crypto/bn/bn_ctx.c:194:1: Parameter `ctx->stack.depth`
  192.   }
  193.   
  194. > void BN_CTX_start(BN_CTX *ctx)
  195.   {
  196.       CTXDBG("ENTER BN_CTX_start()", ctx);

providers/fips/fipsprov.c:144:5: Call
142.       ret = 1;
143.    err:
144.       BN_CTX_end(bnctx);
           ^
145.       BN_CTX_free(bnctx);
146.   

crypto/bn/bn_ctx.c:208:1: Parameter `ctx->stack.depth`
  206.   }
  207.   
  208. > void BN_CTX_end(BN_CTX *ctx)
  209.   {
  210.       if (ctx == NULL)

crypto/bn/bn_ctx.c:216:27: Call
  214.           ctx->err_stack--;
  215.       else {
  216.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  217.           /* Does this stack frame have anything to release? */
  218.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:298:1: <LHS trace>
296.   }
297.   
298. > static unsigned int BN_STACK_pop(BN_STACK *st)
299.   {
300.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:298:1: Parameter `st->depth`
    296.   }
    297.   
    298. > static unsigned int BN_STACK_pop(BN_STACK *st)
    299.   {
    300.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:300:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    298.   static unsigned int BN_STACK_pop(BN_STACK *st)
    299.   {
    300.       return st->indexes[--(st->depth)];
                      ^
    301.   }
    302.   

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['static int dummy_evp_call(void *provctx)\n{\n    OPENSSL_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);\n    EVP_MD_CTX *ctx = EVP_MD_CTX_new();\n    EVP_MD *sha256 = EVP_MD_fetch(libctx, "SHA256", NULL);\n    char msg[] = "Hello World!";\n    const unsigned char exptd[] = {\n        0x7f, 0x83, 0xb1, 0x65, 0x7f, 0xf1, 0xfc, 0x53, 0xb9, 0x2d, 0xc1, 0x81,\n        0x48, 0xa1, 0xd6, 0x5d, 0xfc, 0x2d, 0x4b, 0x1f, 0xa3, 0xd6, 0x77, 0x28,\n        0x4a, 0xdd, 0xd2, 0x00, 0x12, 0x6d, 0x90, 0x69\n    };\n    unsigned int dgstlen = 0;\n    unsigned char dgst[SHA256_DIGEST_LENGTH];\n    int ret = 0;\n    BN_CTX *bnctx = NULL;\n    BIGNUM *a = NULL, *b = NULL;\n    unsigned char randbuf[128];\n    RAND_DRBG *drbg = OPENSSL_CTX_get0_public_drbg(libctx);\n    if (ctx == NULL || sha256 == NULL || drbg == NULL)\n        goto err;\n    if (!EVP_DigestInit_ex(ctx, sha256, NULL))\n        goto err;\n    if (!EVP_DigestUpdate(ctx, msg, sizeof(msg) - 1))\n        goto err;\n    if (!EVP_DigestFinal(ctx, dgst, &dgstlen))\n        goto err;\n    if (dgstlen != sizeof(exptd) || memcmp(dgst, exptd, sizeof(exptd)) != 0)\n        goto err;\n    bnctx = BN_CTX_new_ex(libctx);\n    if (bnctx == NULL)\n        goto err;\n    BN_CTX_start(bnctx);\n    a = BN_CTX_get(bnctx);\n    b = BN_CTX_get(bnctx);\n    if (b == NULL)\n        goto err;\n    BN_zero(a);\n    if (!BN_one(b)\n        || !BN_add(a, a, b)\n        || BN_cmp(a, b) != 0)\n        goto err;\n    if (RAND_DRBG_bytes(drbg, randbuf, sizeof(randbuf)) <= 0)\n        goto err;\n    if (!BN_rand_ex(a, 256, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY, bnctx))\n        goto err;\n    ret = 1;\n err:\n    BN_CTX_end(bnctx);\n    BN_CTX_free(bnctx);\n    EVP_MD_CTX_free(ctx);\n    EVP_MD_meth_free(sha256);\n    return ret;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_start()", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG("LEAVE BN_CTX_start()", ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    if (ctx == NULL)\n        return;\n    CTXDBG("ENTER BN_CTX_end()", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG("LEAVE BN_CTX_end()", ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']