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


crypto/ec/ec2_smpl.c:465:1: Parameter `ctx->pool.used`
463.    * b. Uses algorithm A.10.2 of IEEE P1363.
464.    */
465. > int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
466.                          const EC_POINT *b, BN_CTX *ctx)
467.   {

crypto/ec/ec2_smpl.c:491:10: Call
489.   
490.       BN_CTX_start(ctx);
491.       x0 = BN_CTX_get(ctx);
                ^
492.       y0 = BN_CTX_get(ctx);
493.       x1 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:492:10: Call
490.       BN_CTX_start(ctx);
491.       x0 = BN_CTX_get(ctx);
492.       y0 = BN_CTX_get(ctx);
                ^
493.       x1 = BN_CTX_get(ctx);
494.       y1 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:493:10: Call
491.       x0 = BN_CTX_get(ctx);
492.       y0 = BN_CTX_get(ctx);
493.       x1 = BN_CTX_get(ctx);
                ^
494.       y1 = BN_CTX_get(ctx);
495.       x2 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:494:10: Call
492.       y0 = BN_CTX_get(ctx);
493.       x1 = BN_CTX_get(ctx);
494.       y1 = BN_CTX_get(ctx);
                ^
495.       x2 = BN_CTX_get(ctx);
496.       y2 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:495:10: Call
493.       x1 = BN_CTX_get(ctx);
494.       y1 = BN_CTX_get(ctx);
495.       x2 = BN_CTX_get(ctx);
                ^
496.       y2 = BN_CTX_get(ctx);
497.       s = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:496:10: Call
494.       y1 = BN_CTX_get(ctx);
495.       x2 = BN_CTX_get(ctx);
496.       y2 = BN_CTX_get(ctx);
                ^
497.       s = BN_CTX_get(ctx);
498.       t = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:497:9: Call
495.       x2 = BN_CTX_get(ctx);
496.       y2 = BN_CTX_get(ctx);
497.       s = BN_CTX_get(ctx);
               ^
498.       t = BN_CTX_get(ctx);
499.       if (t == NULL)

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:498:9: Call
496.       y2 = BN_CTX_get(ctx);
497.       s = BN_CTX_get(ctx);
498.       t = BN_CTX_get(ctx);
               ^
499.       if (t == NULL)
500.           goto err;

crypto/bn/bn_ctx.c:284:1: Parameter `ctx->pool.used`
  282.   }
  283.   
  284. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  285.   {
  286.       BIGNUM *ret;

crypto/ec/ec2_smpl.c:571:5: Call
569.   
570.    err:
571.       BN_CTX_end(ctx);
           ^
572.       if (new_ctx != NULL)
573.           BN_CTX_free(new_ctx);

crypto/bn/bn_ctx.c:267:1: Parameter `ctx->pool.used`
  265.   }
  266.   
  267. > void BN_CTX_end(BN_CTX *ctx)
  268.   {
  269.       CTXDBG_ENTRY("BN_CTX_end", ctx);

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

crypto/bn/bn_ctx.c:435:1: <LHS trace>
433.   }
434.   
435. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
436.   {
437.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:435:1: Parameter `p->used`
    433.   }
    434.   
    435. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
    436.   {
    437.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:437:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    435.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    436.   {
    437.       unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
               ^
    438.       p->used -= num;
    439.       while (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) {
            offset = BN_CTX_POOL_SIZE - 1;
            p->current = p->current->prev;
        } else
            offset--;
    }
}
['int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,\n                       const EC_POINT *b, BN_CTX *ctx)\n{\n    BN_CTX *new_ctx = NULL;\n    BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t;\n    int ret = 0;\n    if (EC_POINT_is_at_infinity(group, a)) {\n        if (!EC_POINT_copy(r, b))\n            return 0;\n        return 1;\n    }\n    if (EC_POINT_is_at_infinity(group, b)) {\n        if (!EC_POINT_copy(r, a))\n            return 0;\n        return 1;\n    }\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    x0 = BN_CTX_get(ctx);\n    y0 = BN_CTX_get(ctx);\n    x1 = BN_CTX_get(ctx);\n    y1 = BN_CTX_get(ctx);\n    x2 = BN_CTX_get(ctx);\n    y2 = BN_CTX_get(ctx);\n    s = BN_CTX_get(ctx);\n    t = BN_CTX_get(ctx);\n    if (t == NULL)\n        goto err;\n    if (a->Z_is_one) {\n        if (!BN_copy(x0, a->X))\n            goto err;\n        if (!BN_copy(y0, a->Y))\n            goto err;\n    } else {\n        if (!EC_POINT_get_affine_coordinates_GF2m(group, a, x0, y0, ctx))\n            goto err;\n    }\n    if (b->Z_is_one) {\n        if (!BN_copy(x1, b->X))\n            goto err;\n        if (!BN_copy(y1, b->Y))\n            goto err;\n    } else {\n        if (!EC_POINT_get_affine_coordinates_GF2m(group, b, x1, y1, ctx))\n            goto err;\n    }\n    if (BN_GF2m_cmp(x0, x1)) {\n        if (!BN_GF2m_add(t, x0, x1))\n            goto err;\n        if (!BN_GF2m_add(s, y0, y1))\n            goto err;\n        if (!group->meth->field_div(group, s, s, t, ctx))\n            goto err;\n        if (!group->meth->field_sqr(group, x2, s, ctx))\n            goto err;\n        if (!BN_GF2m_add(x2, x2, group->a))\n            goto err;\n        if (!BN_GF2m_add(x2, x2, s))\n            goto err;\n        if (!BN_GF2m_add(x2, x2, t))\n            goto err;\n    } else {\n        if (BN_GF2m_cmp(y0, y1) || BN_is_zero(x1)) {\n            if (!EC_POINT_set_to_infinity(group, r))\n                goto err;\n            ret = 1;\n            goto err;\n        }\n        if (!group->meth->field_div(group, s, y1, x1, ctx))\n            goto err;\n        if (!BN_GF2m_add(s, s, x1))\n            goto err;\n        if (!group->meth->field_sqr(group, x2, s, ctx))\n            goto err;\n        if (!BN_GF2m_add(x2, x2, s))\n            goto err;\n        if (!BN_GF2m_add(x2, x2, group->a))\n            goto err;\n    }\n    if (!BN_GF2m_add(y2, x1, x2))\n        goto err;\n    if (!group->meth->field_mul(group, y2, y2, s, ctx))\n        goto err;\n    if (!BN_GF2m_add(y2, y2, x2))\n        goto err;\n    if (!BN_GF2m_add(y2, y2, y1))\n        goto err;\n    if (!EC_POINT_set_affine_coordinates_GF2m(group, r, x2, y2, ctx))\n        goto err;\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    if (new_ctx != NULL)\n        BN_CTX_free(new_ctx);\n    return ret;\n}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n{\n    BIGNUM *ret;\n    CTXDBG_ENTRY("BN_CTX_get", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        return NULL;\n    if ((ret = BN_POOL_get(&ctx->pool)) == NULL) {\n        ctx->too_many = 1;\n        BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        return NULL;\n    }\n    BN_zero(ret);\n    ctx->used++;\n    CTXDBG_RET(ctx, ret);\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) {\n            offset = BN_CTX_POOL_SIZE - 1;\n            p->current = p->current->prev;\n        } else\n            offset--;\n    }\n}']