crypto/ec/ecp_smpl.c:709: 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/ecp_smpl.c:637:5: Call
635.       }
636.   
637.       BN_CTX_start(ctx);
           ^
638.       n0 = BN_CTX_get(ctx);
639.       n1 = BN_CTX_get(ctx);

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/ecp_smpl.c:709:13: Call
707.           if (BN_is_zero(n6)) {
708.               /* a is the same point as b */
709.               BN_CTX_end(ctx);
                   ^
710.               ret = EC_POINT_dbl(group, r, a, ctx);
711.               ctx = NULL;

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_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,\n                      const EC_POINT *b, BN_CTX *ctx)\n{\n    int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *,\n                      const BIGNUM *, BN_CTX *);\n    int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);\n    const BIGNUM *p;\n    BN_CTX *new_ctx = NULL;\n    BIGNUM *n0, *n1, *n2, *n3, *n4, *n5, *n6;\n    int ret = 0;\n    if (a == b)\n        return EC_POINT_dbl(group, r, a, ctx);\n    if (EC_POINT_is_at_infinity(group, a))\n        return EC_POINT_copy(r, b);\n    if (EC_POINT_is_at_infinity(group, b))\n        return EC_POINT_copy(r, a);\n    field_mul = group->meth->field_mul;\n    field_sqr = group->meth->field_sqr;\n    p = group->field;\n    if (ctx == NULL) {\n        ctx = new_ctx = BN_CTX_new();\n        if (ctx == NULL)\n            return 0;\n    }\n    BN_CTX_start(ctx);\n    n0 = BN_CTX_get(ctx);\n    n1 = BN_CTX_get(ctx);\n    n2 = BN_CTX_get(ctx);\n    n3 = BN_CTX_get(ctx);\n    n4 = BN_CTX_get(ctx);\n    n5 = BN_CTX_get(ctx);\n    n6 = BN_CTX_get(ctx);\n    if (n6 == NULL)\n        goto end;\n    if (b->Z_is_one) {\n        if (!BN_copy(n1, a->X))\n            goto end;\n        if (!BN_copy(n2, a->Y))\n            goto end;\n    } else {\n        if (!field_sqr(group, n0, b->Z, ctx))\n            goto end;\n        if (!field_mul(group, n1, a->X, n0, ctx))\n            goto end;\n        if (!field_mul(group, n0, n0, b->Z, ctx))\n            goto end;\n        if (!field_mul(group, n2, a->Y, n0, ctx))\n            goto end;\n    }\n    if (a->Z_is_one) {\n        if (!BN_copy(n3, b->X))\n            goto end;\n        if (!BN_copy(n4, b->Y))\n            goto end;\n    } else {\n        if (!field_sqr(group, n0, a->Z, ctx))\n            goto end;\n        if (!field_mul(group, n3, b->X, n0, ctx))\n            goto end;\n        if (!field_mul(group, n0, n0, a->Z, ctx))\n            goto end;\n        if (!field_mul(group, n4, b->Y, n0, ctx))\n            goto end;\n    }\n    if (!BN_mod_sub_quick(n5, n1, n3, p))\n        goto end;\n    if (!BN_mod_sub_quick(n6, n2, n4, p))\n        goto end;\n    if (BN_is_zero(n5)) {\n        if (BN_is_zero(n6)) {\n            BN_CTX_end(ctx);\n            ret = EC_POINT_dbl(group, r, a, ctx);\n            ctx = NULL;\n            goto end;\n        } else {\n            BN_zero(r->Z);\n            r->Z_is_one = 0;\n            ret = 1;\n            goto end;\n        }\n    }\n    if (!BN_mod_add_quick(n1, n1, n3, p))\n        goto end;\n    if (!BN_mod_add_quick(n2, n2, n4, p))\n        goto end;\n    if (a->Z_is_one && b->Z_is_one) {\n        if (!BN_copy(r->Z, n5))\n            goto end;\n    } else {\n        if (a->Z_is_one) {\n            if (!BN_copy(n0, b->Z))\n                goto end;\n        } else if (b->Z_is_one) {\n            if (!BN_copy(n0, a->Z))\n                goto end;\n        } else {\n            if (!field_mul(group, n0, a->Z, b->Z, ctx))\n                goto end;\n        }\n        if (!field_mul(group, r->Z, n0, n5, ctx))\n            goto end;\n    }\n    r->Z_is_one = 0;\n    if (!field_sqr(group, n0, n6, ctx))\n        goto end;\n    if (!field_sqr(group, n4, n5, ctx))\n        goto end;\n    if (!field_mul(group, n3, n1, n4, ctx))\n        goto end;\n    if (!BN_mod_sub_quick(r->X, n0, n3, p))\n        goto end;\n    if (!BN_mod_lshift1_quick(n0, r->X, p))\n        goto end;\n    if (!BN_mod_sub_quick(n0, n3, n0, p))\n        goto end;\n    if (!field_mul(group, n0, n0, n6, ctx))\n        goto end;\n    if (!field_mul(group, n5, n4, n5, ctx))\n        goto end;\n    if (!field_mul(group, n1, n2, n5, ctx))\n        goto end;\n    if (!BN_mod_sub_quick(n0, n0, n1, p))\n        goto end;\n    if (BN_is_odd(n0))\n        if (!BN_add(n0, n0, p))\n            goto end;\n    if (!BN_rshift1(r->Y, n0))\n        goto end;\n    ret = 1;\n end:\n    BN_CTX_end(ctx);\n    BN_CTX_free(new_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}']