engines/ccgost/gost2001.c:115: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 8 steps of the trace


engines/ccgost/gost2001.c:49:5: Call
47.       }
48.   
49.       BN_CTX_start(ctx);
          ^
50.       p = BN_CTX_get(ctx);
51.       a = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:227:1: Parameter `ctx->stack.depth`
  225.   }
  226.   
  227. > void BN_CTX_start(BN_CTX *ctx)
  228.   {
  229.       CTXDBG_ENTRY("BN_CTX_start", ctx);

engines/ccgost/gost2001.c:115:9: Call
113.       if (grp) EC_GROUP_free(grp);
114.       if (ctx) {
115.           BN_CTX_end(ctx);
               ^
116.           BN_CTX_free(ctx);
117.       }

crypto/bn/bn_ctx.c:241:1: Parameter `ctx->stack.depth`
  239.   }
  240.   
  241. > void BN_CTX_end(BN_CTX *ctx)
  242.   {
  243.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:247:27: Call
  245.           ctx->err_stack--;
  246.       else {
  247.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  248.           /* Does this stack frame have anything to release? */
  249.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:319:1: <LHS trace>
317.   }
318.   
319. > static unsigned int BN_STACK_pop(BN_STACK *st)
320.   {
321.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:319:1: Parameter `st->depth`
    317.   }
    318.   
    319. > static unsigned int BN_STACK_pop(BN_STACK *st)
    320.   {
    321.       return st->indexes[--(st->depth)];

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

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int fill_GOST2001_params(EC_KEY *eckey, int nid)\n{\n    R3410_2001_params *params = R3410_2001_paramset;\n    EC_GROUP *grp = NULL;\n    BIGNUM *p = NULL, *q = NULL, *a = NULL, *b = NULL, *x = NULL, *y = NULL;\n    EC_POINT *P = NULL;\n    BN_CTX *ctx = BN_CTX_new();\n    int ok = 0;\n    if(!ctx) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    BN_CTX_start(ctx);\n    p = BN_CTX_get(ctx);\n    a = BN_CTX_get(ctx);\n    b = BN_CTX_get(ctx);\n    x = BN_CTX_get(ctx);\n    y = BN_CTX_get(ctx);\n    q = BN_CTX_get(ctx);\n    if(!p || !a || !b || !x || !y || !q) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    while (params->nid != NID_undef && params->nid != nid)\n        params++;\n    if (params->nid == NID_undef) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS,\n                GOST_R_UNSUPPORTED_PARAMETER_SET);\n        goto err;\n    }\n    if(!BN_hex2bn(&p, params->p)\n        || !BN_hex2bn(&a, params->a)\n        || !BN_hex2bn(&b, params->b)) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS,\n                ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    grp = EC_GROUP_new_curve_GFp(p, a, b, ctx);\n    if(!grp)  {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    P = EC_POINT_new(grp);\n    if(!P)  {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if(!BN_hex2bn(&x, params->x)\n        || !BN_hex2bn(&y, params->y)\n        || !EC_POINT_set_affine_coordinates_GFp(grp, P, x, y, ctx)\n        || !BN_hex2bn(&q, params->q))  {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n#ifdef DEBUG_KEYS\n    fprintf(stderr, "Set params index %d oid %s\\nq=",\n            (params - R3410_2001_paramset), OBJ_nid2sn(params->nid));\n    BN_print_fp(stderr, q);\n    fprintf(stderr, "\\n");\n#endif\n    if(!EC_GROUP_set_generator(grp, P, q, NULL)) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    EC_GROUP_set_curve_name(grp, params->nid);\n    if(!EC_KEY_set_group(eckey, grp)) {\n        GOSTerr(GOST_F_FILL_GOST2001_PARAMS, ERR_R_INTERNAL_ERROR);\n        goto err;\n    }\n    ok = 1;\n err:\n    if (P) EC_POINT_free(P);\n    if (grp) EC_GROUP_free(grp);\n    if (ctx) {\n        BN_CTX_end(ctx);\n        BN_CTX_free(ctx);\n    }\n    return ok;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("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_EXIT(ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("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_EXIT(ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']