crypto/ecdh/ech_ossl.c:202: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 8 steps of the trace


crypto/ecdh/ech_ossl.c:123:2: Call
121.   
122.   	if ((ctx = BN_CTX_new()) == NULL) goto err;
123.   	BN_CTX_start(ctx);
        ^
124.   	x = BN_CTX_get(ctx);
125.   	y = BN_CTX_get(ctx);

crypto/bn/bn_ctx.c:254:1: Parameter `ctx->stack.depth`
  252.   	}
  253.   
  254. > void BN_CTX_start(BN_CTX *ctx)
  255.   	{
  256.   	CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/ecdh/ech_ossl.c:202:11: Call
200.   err:
201.   	if (tmp) EC_POINT_free(tmp);
202.   	if (ctx) BN_CTX_end(ctx);
                 ^
203.   	if (ctx) BN_CTX_free(ctx);
204.   	if (buf) OPENSSL_free(buf);

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

crypto/bn/bn_ctx.c:277:21: Call
  275.   	else
  276.   		{
  277.   		unsigned int fp = BN_STACK_pop(&ctx->stack);
                             ^
  278.   		/* Does this stack frame have anything to release? */
  279.   		if(fp < ctx->used)

crypto/bn/bn_ctx.c:351:1: <LHS trace>
349.   	}
350.   
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352.   	{
353.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
    349.   	}
    350.   
    351. > static unsigned int BN_STACK_pop(BN_STACK *st)
    352.   	{
    353.   	return st->indexes[--(st->depth)];

crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 
    351.   static unsigned int BN_STACK_pop(BN_STACK *st)
    352.   	{
    353.   	return st->indexes[--(st->depth)];
                   ^
    354.   	}
    355.   

static unsigned int BN_STACK_pop(BN_STACK *st)
	{
	return st->indexes[--(st->depth)];
	}
['static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,\n                            void *(*KDF)(void *in, size_t inlen, void *out, size_t outlen))\n\t{\n\tBN_CTX *ctx;\n\tEC_POINT *tmp=NULL;\n\tBIGNUM *x=NULL, *y=NULL;\n\tint ret= -1;\n\tsize_t buflen, len;\n\tunsigned char *buf=NULL;\n\tif (outlen > INT_MAX)\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);\n\t\treturn -1;\n\t\t}\n\tif ((ctx = BN_CTX_new()) == NULL) goto err;\n\tBN_CTX_start(ctx);\n\tx = BN_CTX_get(ctx);\n\ty = BN_CTX_get(ctx);\n\tif (ecdh->priv_key == NULL)\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_NO_PRIVATE_VALUE);\n\t\tgoto err;\n\t\t}\n\tif ((tmp=EC_POINT_new(ecdh->group)) == NULL)\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (!EC_POINT_mul(ecdh->group, tmp, NULL, pub_key, ecdh->priv_key, ctx))\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (EC_METHOD_get_field_type(EC_GROUP_method_of(ecdh->group)) == NID_X9_62_prime_field)\n\t\t{\n\t\tif (!EC_POINT_get_affine_coordinates_GFp(ecdh->group, tmp, x, y, ctx))\n\t\t\t{\n\t\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\tif (!EC_POINT_get_affine_coordinates_GF2m(ecdh->group, tmp, x, y, ctx))\n\t\t\t{\n\t\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_POINT_ARITHMETIC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\tbuflen = (EC_GROUP_get_degree(ecdh->group) + 7)/8;\n\tlen = BN_num_bytes(x);\n\tif (len > buflen)\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR);\n\t\tgoto err;\n\t\t}\n\tif ((buf = OPENSSL_malloc(buflen)) == NULL)\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tmemset(buf, 0, buflen - len);\n\tif (len != (size_t)BN_bn2bin(x, buf + buflen - len))\n\t\t{\n\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_BN_LIB);\n\t\tgoto err;\n\t\t}\n\tif (KDF != 0)\n\t\t{\n\t\tif (KDF(buf, buflen, out, outlen) == NULL)\n\t\t\t{\n\t\t\tECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ECDH_R_KDF_FAILED);\n\t\t\tgoto err;\n\t\t\t}\n\t\tret = outlen;\n\t\t}\n\telse\n\t\t{\n\t\tif (outlen > buflen)\n\t\t\toutlen = buflen;\n\t\tmemcpy(out, buf, outlen);\n\t\tret = outlen;\n\t\t}\nerr:\n\tif (tmp) EC_POINT_free(tmp);\n\tif (ctx) BN_CTX_end(ctx);\n\tif (ctx) BN_CTX_free(ctx);\n\tif (buf) OPENSSL_free(buf);\n\treturn(ret);\n\t}', 'void BN_CTX_start(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_start", ctx);\n\tif(ctx->err_stack || ctx->too_many)\n\t\tctx->err_stack++;\n\telse if(!BN_STACK_push(&ctx->stack, ctx->used))\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n\t\tctx->err_stack++;\n\t\t}\n\tCTXDBG_EXIT(ctx);\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 unsigned int BN_STACK_pop(BN_STACK *st)\n\t{\n\treturn st->indexes[--(st->depth)];\n\t}']