crypto/ec/ecp_smpl.c:829: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 9 steps of the trace


crypto/ec/ecp_smpl.c:648:1: Parameter `ctx->stack.depth`
646.   }
647.   
648. > int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
649.                         const EC_POINT *b, BN_CTX *ctx)
650.   {

crypto/ec/ecp_smpl.c:676:5: Call
674.       }
675.   
676.       BN_CTX_start(ctx);
           ^
677.       n0 = BN_CTX_get(ctx);
678.       n1 = BN_CTX_get(ctx);

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

crypto/ec/ecp_smpl.c:829:9: Call
827.    end:
828.       if (ctx)                    /* otherwise we already called BN_CTX_end */
829.           BN_CTX_end(ctx);
               ^
830.       BN_CTX_free(new_ctx);
831.       return ret;

crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth`
  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: <LHS 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:328:12: Binary operation: ([0, +oo] - 1):unsigned32 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 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    if (ctx)\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_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}']