crypto/ec/ecp_smpl.c:1382: 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:1298:1: Parameter `ctx->pool.used`
1296.   
1297.   
1298. > int ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx)
1299.   	{
1300.   	int (*field_mul)(const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);

crypto/ec/ecp_smpl.c:1322:7: Call
1320.   
1321.   	BN_CTX_start(ctx);
1322.   	rh = BN_CTX_get(ctx);
              ^
1323.   	tmp = BN_CTX_get(ctx);
1324.   	Z4 = BN_CTX_get(ctx);

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

crypto/ec/ecp_smpl.c:1323:8: Call
1321.   	BN_CTX_start(ctx);
1322.   	rh = BN_CTX_get(ctx);
1323.   	tmp = BN_CTX_get(ctx);
               ^
1324.   	Z4 = BN_CTX_get(ctx);
1325.   	Z6 = BN_CTX_get(ctx);

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

crypto/ec/ecp_smpl.c:1324:7: Call
1322.   	rh = BN_CTX_get(ctx);
1323.   	tmp = BN_CTX_get(ctx);
1324.   	Z4 = BN_CTX_get(ctx);
              ^
1325.   	Z6 = BN_CTX_get(ctx);
1326.   	if (Z6 == NULL) goto err;

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

crypto/ec/ecp_smpl.c:1325:7: Call
1323.   	tmp = BN_CTX_get(ctx);
1324.   	Z4 = BN_CTX_get(ctx);
1325.   	Z6 = BN_CTX_get(ctx);
              ^
1326.   	if (Z6 == NULL) goto err;
1327.   

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

crypto/ec/ecp_smpl.c:1382:2: Call
1380.   
1381.    err:
1382.   	BN_CTX_end(ctx);
         ^
1383.   	if (new_ctx != NULL)
1384.   		BN_CTX_free(new_ctx);

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

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

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

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

crypto/bn/bn_ctx.c:440:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    438.   static void BN_POOL_release(BN_POOL *p, unsigned int num)
    439.   	{
    440.   	unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
            ^
    441.   	p->used -= num;
    442.   	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_is_on_curve(const EC_GROUP *group, const EC_POINT *point, 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\tconst BIGNUM *p;\n\tBN_CTX *new_ctx = NULL;\n\tBIGNUM *rh, *tmp, *Z4, *Z6;\n\tint ret = -1;\n\tif (EC_POINT_is_at_infinity(group, point))\n\t\treturn 1;\n\tfield_mul = group->meth->field_mul;\n\tfield_sqr = group->meth->field_sqr;\n\tp = &group->field;\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\trh = BN_CTX_get(ctx);\n\ttmp = BN_CTX_get(ctx);\n\tZ4 = BN_CTX_get(ctx);\n\tZ6 = BN_CTX_get(ctx);\n\tif (Z6 == NULL) goto err;\n\tif (!field_sqr(group, rh, &point->X, ctx)) goto err;\n\tif (!point->Z_is_one)\n\t\t{\n\t\tif (!field_sqr(group, tmp, &point->Z, ctx)) goto err;\n\t\tif (!field_sqr(group, Z4, tmp, ctx)) goto err;\n\t\tif (!field_mul(group, Z6, Z4, tmp, ctx)) goto err;\n\t\tif (group->a_is_minus3)\n\t\t\t{\n\t\t\tif (!BN_mod_lshift1_quick(tmp, Z4, p)) goto err;\n\t\t\tif (!BN_mod_add_quick(tmp, tmp, Z4, p)) goto err;\n\t\t\tif (!BN_mod_sub_quick(rh, rh, tmp, p)) goto err;\n\t\t\tif (!field_mul(group, rh, rh, &point->X, ctx)) goto err;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tif (!field_mul(group, tmp, Z4, &group->a, ctx)) goto err;\n\t\t\tif (!BN_mod_add_quick(rh, rh, tmp, p)) goto err;\n\t\t\tif (!field_mul(group, rh, rh, &point->X, ctx)) goto err;\n\t\t\t}\n\t\tif (!field_mul(group, tmp, &group->b, Z6, ctx)) goto err;\n\t\tif (!BN_mod_add_quick(rh, rh, tmp, p)) goto err;\n\t\t}\n\telse\n\t\t{\n\t\tif (!BN_mod_add_quick(rh, rh, &group->a, p)) goto err;\n\t\tif (!field_mul(group, rh, rh, &point->X, ctx)) goto err;\n\t\tif (!BN_mod_add_quick(rh, rh, &group->b, p)) goto err;\n\t\t}\n\tif (!field_sqr(group, tmp, &point->Y, ctx)) goto err;\n\tret = (0 == BN_ucmp(tmp, rh));\n err:\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}']