engines/ccgost/gost2001.c:114: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace


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

crypto/bn/bn_ctx.c:236:1: Parameter `*ctx->stack.indexes`
  234.   }
  235.   
  236. > void BN_CTX_start(BN_CTX *ctx)
  237.   {
  238.       CTXDBG_ENTRY("BN_CTX_start", ctx);

engines/ccgost/gost2001.c:114:9: Call
112.       EC_GROUP_free(grp);
113.       if (ctx)
114.           BN_CTX_end(ctx);
               ^
115.       BN_CTX_free(ctx);
116.       return ok;

crypto/bn/bn_ctx.c:250:1: Parameter `*ctx->stack.indexes`
  248.   }
  249.   
  250. > void BN_CTX_end(BN_CTX *ctx)
  251.   {
  252.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:256:27: Call
  254.           ctx->err_stack--;
  255.       else {
  256.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  257.           /* Does this stack frame have anything to release? */
  258.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:326:1: <Offset trace>
324.   }
325.   
326. > static unsigned int BN_STACK_pop(BN_STACK *st)
327.   {
328.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:326:1: Parameter `st->depth`
    324.   }
    325.   
    326. > static unsigned int BN_STACK_pop(BN_STACK *st)
    327.   {
    328.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:326:1: <Length trace>
324.   }
325.   
326. > static unsigned int BN_STACK_pop(BN_STACK *st)
327.   {
328.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:326:1: Parameter `*st->indexes`
    324.   }
    325.   
    326. > static unsigned int BN_STACK_pop(BN_STACK *st)
    327.   {
    328.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:328:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 
    326.   static unsigned int BN_STACK_pop(BN_STACK *st)
    327.   {
    328.       return st->indexes[--(st->depth)];
                      ^
    329.   }
    330.   

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    EC_POINT_free(P);\n    EC_GROUP_free(grp);\n    if (ctx)\n        BN_CTX_end(ctx);\n    BN_CTX_free(ctx);\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}']