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


crypto/ec/ec2_smpl.c:813:13: Call
811.           || !BN_GF2m_add(t1, t2, t1)
812.           || !group->meth->field_mul(group, t2, p->X, t0, ctx)
813.           || !BN_GF2m_mod_inv(t2, t2, group->field, ctx)
                   ^
814.           || !group->meth->field_mul(group, t1, t1, t2, ctx)
815.           || !group->meth->field_mul(group, r->X, r->Z, t2, ctx)

crypto/bn/bn_gf2m.c:755:5: Call
  753.   
  754.    err:
  755.       BN_CTX_end(ctx);
             ^
  756.       return ret;
  757.   }

crypto/bn/bn_ctx.c:195:1: Parameter `ctx->pool.used`
    193.   }
    194.   
    195. > void BN_CTX_end(BN_CTX *ctx)
    196.   {
    197.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/ec/ec2_smpl.c:831:5: Call
829.   
830.    err:
831.       BN_CTX_end(ctx);
           ^
832.       return ret;
833.   }

crypto/bn/bn_ctx.c:195:1: Parameter `ctx->pool.used`
  193.   }
  194.   
  195. > void BN_CTX_end(BN_CTX *ctx)
  196.   {
  197.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:204:13: Call
  202.           /* Does this stack frame have anything to release? */
  203.           if (fp < ctx->used)
  204.               BN_POOL_release(&ctx->pool, ctx->used - fp);
                     ^
  205.           ctx->used = fp;
  206.           /* Unjam "too_many" in case "get" had failed */

crypto/bn/bn_ctx.c:346:1: <LHS trace>
344.   }
345.   
346. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
347.   {
348.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:346:1: Parameter `p->used`
    344.   }
    345.   
    346. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
    347.   {
    348.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:348:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    346.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    347.   {
    348.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
               ^
    349.   
    350.       p->used -= num;

static void BN_POOL_release(BN_POOL *p, unsigned int num)
{
    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
    p->used -= num;
    while (num--) {
        bn_check_top(p->current->vals + offset);
        if (offset == 0) {
            offset = BN_CTX_POOL_SIZE - 1;
            p->current = p->current->prev;
        } else
            offset--;
    }
}
['static\nint ec_GF2m_simple_ladder_post(const EC_GROUP *group,\n                               EC_POINT *r, EC_POINT *s,\n                               EC_POINT *p, BN_CTX *ctx)\n{\n    int ret = 0;\n    BIGNUM *t0, *t1, *t2 = NULL;\n    if (BN_is_zero(r->Z))\n        return EC_POINT_set_to_infinity(group, r);\n    if (BN_is_zero(s->Z)) {\n        if (!EC_POINT_copy(r, p)\n            || !EC_POINT_invert(group, r, ctx)) {\n            ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_POST, ERR_R_EC_LIB);\n            return 0;\n        }\n        return 1;\n    }\n    BN_CTX_start(ctx);\n    t0 = BN_CTX_get(ctx);\n    t1 = BN_CTX_get(ctx);\n    t2 = BN_CTX_get(ctx);\n    if (t2 == NULL) {\n        ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_POST, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (!group->meth->field_mul(group, t0, r->Z, s->Z, ctx)\n        || !group->meth->field_mul(group, t1, p->X, r->Z, ctx)\n        || !BN_GF2m_add(t1, r->X, t1)\n        || !group->meth->field_mul(group, t2, p->X, s->Z, ctx)\n        || !group->meth->field_mul(group, r->Z, r->X, t2, ctx)\n        || !BN_GF2m_add(t2, t2, s->X)\n        || !group->meth->field_mul(group, t1, t1, t2, ctx)\n        || !group->meth->field_sqr(group, t2, p->X, ctx)\n        || !BN_GF2m_add(t2, p->Y, t2)\n        || !group->meth->field_mul(group, t2, t2, t0, ctx)\n        || !BN_GF2m_add(t1, t2, t1)\n        || !group->meth->field_mul(group, t2, p->X, t0, ctx)\n        || !BN_GF2m_mod_inv(t2, t2, group->field, ctx)\n        || !group->meth->field_mul(group, t1, t1, t2, ctx)\n        || !group->meth->field_mul(group, r->X, r->Z, t2, ctx)\n        || !BN_GF2m_add(t2, p->X, r->X)\n        || !group->meth->field_mul(group, t2, t2, t1, ctx)\n        || !BN_GF2m_add(r->Y, p->Y, t2)\n        || !BN_one(r->Z))\n        goto err;\n    r->Z_is_one = 1;\n    BN_set_negative(r->X, 0);\n    BN_set_negative(r->Y, 0);\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    return ret;\n}', 'int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)\n{\n    BIGNUM *b = NULL;\n    int ret = 0;\n    BN_CTX_start(ctx);\n    if ((b = BN_CTX_get(ctx)) == NULL)\n        goto err;\n    do {\n        if (!BN_priv_rand(b, BN_num_bits(p) - 1,\n                          BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))\n            goto err;\n    } while (BN_is_zero(b));\n    if (!BN_GF2m_mod_mul(r, a, b, p, ctx))\n        goto err;\n    if (!BN_GF2m_mod_inv_vartime(r, r, p, ctx))\n        goto err;\n    if (!BN_GF2m_mod_mul(r, r, b, p, ctx))\n        goto err;\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    return ret;\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 void BN_POOL_release(BN_POOL *p, unsigned int num)\n{\n    unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n    p->used -= num;\n    while (num--) {\n        bn_check_top(p->current->vals + offset);\n        if (offset == 0) {\n            offset = BN_CTX_POOL_SIZE - 1;\n            p->current = p->current->prev;\n        } else\n            offset--;\n    }\n}']