crypto/ec/ec_curve.c:3317: error: BUFFER_OVERRUN_L3
  Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace


crypto/ec/ec_curve.c:3241:5: Call
3239.       if (ctx == NULL)
3240.           return -1;
3241.       BN_CTX_start(ctx);
            ^
3242.   
3243.       /*

crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
  169.   }
  170.   
  171. > void BN_CTX_start(BN_CTX *ctx)
  172.   {
  173.       CTXDBG("ENTER BN_CTX_start()", ctx);

crypto/ec/ec_curve.c:3317:5: Call
3315.   end:
3316.       OPENSSL_free(param_bytes);
3317.       BN_CTX_end(ctx);
            ^
3318.       BN_CTX_free(ctx);
3319.       return ret;

crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
  183.   }
  184.   
  185. > void BN_CTX_end(BN_CTX *ctx)
  186.   {
  187.       if (ctx == NULL)

crypto/bn/bn_ctx.c:193:27: Call
  191.           ctx->err_stack--;
  192.       else {
  193.           unsigned int fp = BN_STACK_pop(&ctx->stack);
                                   ^
  194.           /* Does this stack frame have anything to release? */
  195.           if (fp < ctx->used)

crypto/bn/bn_ctx.c:268:1: <Offset trace>
266.   }
267.   
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269.   {
270.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:1: Parameter `st->depth`
    266.   }
    267.   
    268. > static unsigned int BN_STACK_pop(BN_STACK *st)
    269.   {
    270.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:1: <Length trace>
266.   }
267.   
268. > static unsigned int BN_STACK_pop(BN_STACK *st)
269.   {
270.       return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:268:1: Parameter `*st->indexes`
    266.   }
    267.   
    268. > static unsigned int BN_STACK_pop(BN_STACK *st)
    269.   {
    270.       return st->indexes[--(st->depth)];

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

static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int ec_curve_nid_from_params(const EC_GROUP *group)\n{\n    int ret = -1, nid, len, field_type, param_len;\n    size_t i, seed_len;\n    const unsigned char *seed, *params_seed, *params;\n    unsigned char *param_bytes = NULL;\n    const EC_CURVE_DATA *data;\n    const EC_POINT *generator = NULL;\n    const EC_METHOD *meth;\n    const BIGNUM *cofactor = NULL;\n    BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL};\n    BN_CTX *ctx = NULL;\n    meth = EC_GROUP_method_of(group);\n    if (meth == NULL)\n        return -1;\n    nid = EC_GROUP_get_curve_name(group);\n    field_type = EC_METHOD_get_field_type(meth);\n    seed_len = EC_GROUP_get_seed_len(group);\n    seed = EC_GROUP_get0_seed(group);\n    cofactor = EC_GROUP_get0_cofactor(group);\n    ctx = BN_CTX_new();\n    if (ctx == NULL)\n        return -1;\n    BN_CTX_start(ctx);\n    param_len = BN_num_bytes(group->order);\n    len = BN_num_bytes(group->field);\n    if (len > param_len)\n        param_len = len;\n    param_bytes = OPENSSL_malloc(param_len * NUM_BN_FIELDS);\n    if (param_bytes == NULL)\n        goto end;\n    for (i = 0; i < NUM_BN_FIELDS; ++i) {\n        if ((bn[i] = BN_CTX_get(ctx)) == NULL)\n            goto end;\n    }\n    if (!(EC_GROUP_get_curve(group, bn[0], bn[1], bn[2], ctx)\n        && ((generator = EC_GROUP_get0_generator(group)) != NULL)\n        && EC_POINT_get_affine_coordinates(group, generator, bn[3], bn[4], ctx)\n        && EC_GROUP_get_order(group, bn[5], ctx)))\n        goto end;\n    for (i = 0; i < NUM_BN_FIELDS; ++i) {\n        if (BN_bn2binpad(bn[i], &param_bytes[i*param_len], param_len) <= 0)\n            goto end;\n    }\n    for (i = 0; i < curve_list_length; i++) {\n        const ec_list_element curve = curve_list[i];\n        data = curve.data;\n        params_seed = (const unsigned char *)(data + 1);\n        params = params_seed + data->seed_len;\n        if (data->field_type == field_type\n            && param_len == data->param_len\n            && (nid <= 0 || nid == curve.nid)\n            && (BN_is_zero(cofactor)\n                || BN_is_word(cofactor, (const BN_ULONG)curve.data->cofactor))\n            && (data->seed_len == 0 || seed_len == 0\n                || ((size_t)data->seed_len == seed_len\n                     && OPENSSL_memcmp(params_seed, seed, seed_len) == 0))\n            && OPENSSL_memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)\n                              == 0) {\n            ret = curve.nid;\n            goto end;\n        }\n    }\n    ret = NID_undef;\nend:\n    OPENSSL_free(param_bytes);\n    BN_CTX_end(ctx);\n    BN_CTX_free(ctx);\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}']