crypto/ec/ecp_smpl.c:845: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `BN_bn2bin`.
Showing all 11 steps of the trace


crypto/ec/ecp_smpl.c:822:7: Call
820.   		used_ctx = 1;
821.   		x = BN_CTX_get(ctx);
822.   		y = BN_CTX_get(ctx);
             ^
823.   		if (y == NULL) goto err;
824.   

crypto/bn/bn_ctx.c:302:2: Call
  300.   		}
  301.   	/* OK, make sure the returned bignum is "zero" */
  302.   	BN_zero(ret);
          ^
  303.   	ctx->used++;
  304.   	CTXDBG_RET(ctx, ret);

crypto/bn/bn_lib.c:586:1: Parameter `a->top`
    584.   	}
    585.   
    586. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    587.   	{
    588.   	bn_check_top(a);

crypto/ec/ecp_smpl.c:834:22: Call
832.   		i = 1;
833.   		
834.   		skip = field_len - BN_num_bytes(x);
                            ^
835.   		if (skip > field_len)
836.   			{

crypto/bn/bn_lib.c:248:1: Parameter `a->top`
  246.   	}
  247.   
  248. > int BN_num_bits(const BIGNUM *a)
  249.   	{
  250.   	int i = a->top - 1;

crypto/ec/ecp_smpl.c:845:10: Call
843.   			skip--;
844.   			}
845.   		skip = BN_bn2bin(x, buf + i);
                ^
846.   		i += skip;
847.   		if (i != 1 + field_len)

crypto/bn/bn_lib.c:641:1: Parameter `a->top`
  639.   
  640.   /* ignore negative */
  641. > int BN_bn2bin(const BIGNUM *a, unsigned char *to)
  642.   	{
  643.   	int n,i;

crypto/bn/bn_lib.c:647:6: Call
  645.   
  646.   	bn_check_top(a);
  647.   	n=i=BN_num_bytes(a);
              ^
  648.   	while (i--)
  649.   		{

crypto/bn/bn_lib.c:248:1: <LHS trace>
246.   	}
247.   
248. > int BN_num_bits(const BIGNUM *a)
249.   	{
250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:248:1: Parameter `a->top`
    246.   	}
    247.   
    248. > int BN_num_bits(const BIGNUM *a)
    249.   	{
    250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:250:2: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BN_bn2bin` 
    248.   int BN_num_bits(const BIGNUM *a)
    249.   	{
    250.   	int i = a->top - 1;
            ^
    251.   	bn_check_top(a);
    252.   

int BN_num_bits(const BIGNUM *a)
	{
	int i = a->top - 1;
	bn_check_top(a);
	if (BN_is_zero(a)) return 0;
	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
	}
['size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, point_conversion_form_t form,\n\tunsigned char *buf, size_t len, BN_CTX *ctx)\n\t{\n\tsize_t ret;\n\tBN_CTX *new_ctx = NULL;\n\tint used_ctx = 0;\n\tBIGNUM *x, *y;\n\tsize_t field_len, i, skip;\n\tif ((form != POINT_CONVERSION_COMPRESSED)\n\t\t&& (form != POINT_CONVERSION_UNCOMPRESSED)\n\t\t&& (form != POINT_CONVERSION_HYBRID))\n\t\t{\n\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);\n\t\tgoto err;\n\t\t}\n\tif (EC_POINT_is_at_infinity(group, point))\n\t\t{\n\t\tif (buf != NULL)\n\t\t\t{\n\t\t\tif (len < 1)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\tbuf[0] = 0;\n\t\t\t}\n\t\treturn 1;\n\t\t}\n\tfield_len = BN_num_bytes(&group->field);\n\tret = (form == POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2*field_len;\n\tif (buf != NULL)\n\t\t{\n\t\tif (len < ret)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (ctx == NULL)\n\t\t\t{\n\t\t\tctx = new_ctx = BN_CTX_new();\n\t\t\tif (ctx == NULL)\n\t\t\t\treturn 0;\n\t\t\t}\n\t\tBN_CTX_start(ctx);\n\t\tused_ctx = 1;\n\t\tx = BN_CTX_get(ctx);\n\t\ty = BN_CTX_get(ctx);\n\t\tif (y == NULL) goto err;\n\t\tif (!EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ctx)) goto err;\n\t\tif ((form == POINT_CONVERSION_COMPRESSED || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y))\n\t\t\tbuf[0] = form + 1;\n\t\telse\n\t\t\tbuf[0] = form;\n\t\ti = 1;\n\t\tskip = field_len - BN_num_bytes(x);\n\t\tif (skip > field_len)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n\t\t\tgoto err;\n\t\t\t}\n\t\twhile (skip > 0)\n\t\t\t{\n\t\t\tbuf[i++] = 0;\n\t\t\tskip--;\n\t\t\t}\n\t\tskip = BN_bn2bin(x, buf + i);\n\t\ti += skip;\n\t\tif (i != 1 + field_len)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (form == POINT_CONVERSION_UNCOMPRESSED || form == POINT_CONVERSION_HYBRID)\n\t\t\t{\n\t\t\tskip = field_len - BN_num_bytes(y);\n\t\t\tif (skip > field_len)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\twhile (skip > 0)\n\t\t\t\t{\n\t\t\t\tbuf[i++] = 0;\n\t\t\t\tskip--;\n\t\t\t\t}\n\t\t\tskip = BN_bn2bin(y, buf + i);\n\t\t\ti += skip;\n\t\t\t}\n\t\tif (i != ret)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\tif (used_ctx)\n\t\tBN_CTX_end(ctx);\n\tif (new_ctx != NULL)\n\t\tBN_CTX_free(new_ctx);\n\treturn ret;\n err:\n\tif (used_ctx)\n\t\tBN_CTX_end(ctx);\n\tif (new_ctx != NULL)\n\t\tBN_CTX_free(new_ctx);\n\treturn 0;\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}', 'int BN_set_word(BIGNUM *a, BN_ULONG w)\n\t{\n\tbn_check_top(a);\n\tif (bn_expand(a,(int)sizeof(BN_ULONG)*8) == NULL) return(0);\n\ta->neg = 0;\n\ta->d[0] = w;\n\ta->top = (w ? 1 : 0);\n\tbn_check_top(a);\n\treturn(1);\n\t}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tint i = a->top - 1;\n\tbn_check_top(a);\n\tif (BN_is_zero(a)) return 0;\n\treturn ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));\n\t}', 'int BN_bn2bin(const BIGNUM *a, unsigned char *to)\n\t{\n\tint n,i;\n\tBN_ULONG l;\n\tbn_check_top(a);\n\tn=i=BN_num_bytes(a);\n\twhile (i--)\n\t\t{\n\t\tl=a->d[i/BN_BYTES];\n\t\t*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;\n\t\t}\n\treturn(n);\n\t}']