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


crypto/ec/ecp_smpl.c:1045:1: Parameter `ctx->pool.used`
1043.   
1044.   
1045. > int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)
1046.   	{
1047.   	/*-

crypto/ec/ecp_smpl.c:1085:9: Call
1083.   
1084.   	BN_CTX_start(ctx);
1085.   	tmp1 = BN_CTX_get(ctx);
                ^
1086.   	tmp2 = BN_CTX_get(ctx);
1087.   	Za23 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:290:1: Parameter `ctx->pool.used`
  288.   	}
  289.   
  290. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  291.   	{
  292.   	BIGNUM *ret;

crypto/ec/ecp_smpl.c:1086:9: Call
1084.   	BN_CTX_start(ctx);
1085.   	tmp1 = BN_CTX_get(ctx);
1086.   	tmp2 = BN_CTX_get(ctx);
                ^
1087.   	Za23 = BN_CTX_get(ctx);
1088.   	Zb23 = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:290:1: Parameter `ctx->pool.used`
  288.   	}
  289.   
  290. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  291.   	{
  292.   	BIGNUM *ret;

crypto/ec/ecp_smpl.c:1087:9: Call
1085.   	tmp1 = BN_CTX_get(ctx);
1086.   	tmp2 = BN_CTX_get(ctx);
1087.   	Za23 = BN_CTX_get(ctx);
                ^
1088.   	Zb23 = BN_CTX_get(ctx);
1089.   	if (Zb23 == NULL) goto end;

crypto/bn/bn_ctx.c:290:1: Parameter `ctx->pool.used`
  288.   	}
  289.   
  290. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  291.   	{
  292.   	BIGNUM *ret;

crypto/ec/ecp_smpl.c:1088:9: Call
1086.   	tmp2 = BN_CTX_get(ctx);
1087.   	Za23 = BN_CTX_get(ctx);
1088.   	Zb23 = BN_CTX_get(ctx);
                ^
1089.   	if (Zb23 == NULL) goto end;
1090.   

crypto/bn/bn_ctx.c:290:1: Parameter `ctx->pool.used`
  288.   	}
  289.   
  290. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  291.   	{
  292.   	BIGNUM *ret;

crypto/ec/ecp_smpl.c:1151:2: Call
1149.   
1150.    end:
1151.   	BN_CTX_end(ctx);
         ^
1152.   	if (new_ctx != NULL)
1153.   		BN_CTX_free(new_ctx);

crypto/bn/bn_ctx.c:272:1: Parameter `ctx->pool.used`
  270.   	}
  271.   
  272. > void BN_CTX_end(BN_CTX *ctx)
  273.   	{
  274.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:282:4: Call
  280.   		/* Does this stack frame have anything to release? */
  281.   		if(fp < ctx->used)
  282.   			BN_POOL_release(&ctx->pool, ctx->used - fp);
            ^
  283.   		ctx->used = fp;
  284.   		/* Unjam "too_many" in case "get" had failed */

crypto/bn/bn_ctx.c:440:1: <LHS trace>
438.   	}
439.   
440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
441.   	{
442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:440:1: Parameter `p->used`
    438.   	}
    439.   
    440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
    441.   	{
    442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;

crypto/bn/bn_ctx.c:442:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    440.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    441.   	{
    442.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
            ^
    443.   	p->used -= num;
    444.   	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_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx)\n\t{\n\tint (*field_mul)(const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);\n\tint (*field_sqr)(const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);\n\tBN_CTX *new_ctx = NULL;\n\tBIGNUM *tmp1, *tmp2, *Za23, *Zb23;\n\tconst BIGNUM *tmp1_, *tmp2_;\n\tint ret = -1;\n\tif (EC_POINT_is_at_infinity(group, a))\n\t\t{\n\t\treturn EC_POINT_is_at_infinity(group, b) ? 0 : 1;\n\t\t}\n\tif (EC_POINT_is_at_infinity(group, b))\n\t\treturn 1;\n\tif (a->Z_is_one && b->Z_is_one)\n\t\t{\n\t\treturn ((BN_cmp(a->X, b->X) == 0) && BN_cmp(a->Y, b->Y) == 0) ? 0 : 1;\n\t\t}\n\tfield_mul = group->meth->field_mul;\n\tfield_sqr = group->meth->field_sqr;\n\tif (ctx == NULL)\n\t\t{\n\t\tctx = new_ctx = BN_CTX_new();\n\t\tif (ctx == NULL)\n\t\t\treturn -1;\n\t\t}\n\tBN_CTX_start(ctx);\n\ttmp1 = BN_CTX_get(ctx);\n\ttmp2 = BN_CTX_get(ctx);\n\tZa23 = BN_CTX_get(ctx);\n\tZb23 = BN_CTX_get(ctx);\n\tif (Zb23 == NULL) goto end;\n\tif (!b->Z_is_one)\n\t\t{\n\t\tif (!field_sqr(group, Zb23, b->Z, ctx)) goto end;\n\t\tif (!field_mul(group, tmp1, a->X, Zb23, ctx)) goto end;\n\t\ttmp1_ = tmp1;\n\t\t}\n\telse\n\t\ttmp1_ = a->X;\n\tif (!a->Z_is_one)\n\t\t{\n\t\tif (!field_sqr(group, Za23, a->Z, ctx)) goto end;\n\t\tif (!field_mul(group, tmp2, b->X, Za23, ctx)) goto end;\n\t\ttmp2_ = tmp2;\n\t\t}\n\telse\n\t\ttmp2_ = b->X;\n\tif (BN_cmp(tmp1_, tmp2_) != 0)\n\t\t{\n\t\tret = 1;\n\t\tgoto end;\n\t\t}\n\tif (!b->Z_is_one)\n\t\t{\n\t\tif (!field_mul(group, Zb23, Zb23, b->Z, ctx)) goto end;\n\t\tif (!field_mul(group, tmp1, a->Y, Zb23, ctx)) goto end;\n\t\t}\n\telse\n\t\ttmp1_ = a->Y;\n\tif (!a->Z_is_one)\n\t\t{\n\t\tif (!field_mul(group, Za23, Za23, a->Z, ctx)) goto end;\n\t\tif (!field_mul(group, tmp2, b->Y, Za23, ctx)) goto end;\n\t\t}\n\telse\n\t\ttmp2_ = b->Y;\n\tif (BN_cmp(tmp1_, tmp2_) != 0)\n\t\t{\n\t\tret = 1;\n\t\tgoto end;\n\t\t}\n\tret = 0;\n end:\n\tBN_CTX_end(ctx);\n\tif (new_ctx != NULL)\n\t\tBN_CTX_free(new_ctx);\n\treturn ret;\n\t}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n\t{\n\tBIGNUM *ret;\n\tCTXDBG_ENTRY("BN_CTX_get", ctx);\n\tif(ctx->err_stack || ctx->too_many) return NULL;\n\tif((ret = BN_POOL_get(&ctx->pool)) == NULL)\n\t\t{\n\t\tctx->too_many = 1;\n\t\tBNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\treturn NULL;\n\t\t}\n\tBN_zero(ret);\n\tctx->used++;\n\tCTXDBG_RET(ctx, ret);\n\treturn ret;\n\t}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_end", ctx);\n\tif(ctx->err_stack)\n\t\tctx->err_stack--;\n\telse\n\t\t{\n\t\tunsigned int fp = BN_STACK_pop(&ctx->stack);\n\t\tif(fp < ctx->used)\n\t\t\tBN_POOL_release(&ctx->pool, ctx->used - fp);\n\t\tctx->used = fp;\n\t\tctx->too_many = 0;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}', 'static void BN_POOL_release(BN_POOL *p, unsigned int num)\n\t{\n\tunsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;\n\tp->used -= num;\n\twhile(num--)\n\t\t{\n\t\tbn_check_top(p->current->vals + offset);\n\t\tif(!offset)\n\t\t\t{\n\t\t\toffset = BN_CTX_POOL_SIZE - 1;\n\t\t\tp->current = p->current->prev;\n\t\t\t}\n\t\telse\n\t\t\toffset--;\n\t\t}\n\t}']