crypto/ec/ec_asn1.c:335: error: INTEGER_OVERFLOW_L1
  (0 - 1):unsigned64 by call to `BN_to_ASN1_INTEGER`.
Showing all 8 steps of the trace


crypto/ec/ec_asn1.c:323:14: Call
321.   	if (nid == NID_X9_62_prime_field)
322.   		{
323.   		if ((tmp = BN_new()) == NULL) 
                    ^
324.   			{
325.   			ECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:308:2: Assignment
  306.   		}
  307.   	ret->flags=BN_FLG_MALLOCED;
  308.   	ret->top=0;
          ^
  309.   	ret->neg=0;
  310.   	ret->dmax=0;

crypto/ec/ec_asn1.c:335:20: Call
333.   			}
334.   		/* set the prime number */
335.   		field->p.prime = BN_to_ASN1_INTEGER(tmp,NULL);
                          ^
336.   		if (field->p.prime == NULL)
337.   			{

crypto/asn1/a_int.c:405:1: Parameter `bn->top`
  403.   	}
  404.   
  405. > ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
  406.   	{
  407.   	ASN1_INTEGER *ret;

crypto/asn1/a_int.c:422:4: Call
  420.   		ret->type = V_ASN1_NEG_INTEGER;
  421.   	else ret->type=V_ASN1_INTEGER;
  422.   	j=BN_num_bits(bn);
            ^
  423.   	len=((j == 0)?0:((j/8)+1));
  424.   	if (ret->length < len+4)

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 - 1):unsigned64 by call to `BN_to_ASN1_INTEGER` 
    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]));
	}
['static int ec_asn1_group2fieldid(const EC_GROUP *group, X9_62_FIELDID *field)\n\t{\n\tint\t\t\tok=0, nid;\n\tBIGNUM\t\t\t*tmp = NULL;\n\tif (group == NULL || field == NULL)\n\t\treturn 0;\n\tif (field->fieldType != NULL)\n\t\tASN1_OBJECT_free(field->fieldType);\n\tif (field->p.other != NULL)\n\t\tASN1_TYPE_free(field->p.other);\n\tnid = EC_METHOD_get_field_type(EC_GROUP_method_of(group));\n\tif ((field->fieldType = OBJ_nid2obj(nid)) == NULL)\n\t\t{\n\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_OBJ_LIB);\n\t\tgoto err;\n\t\t}\n\tif (nid == NID_X9_62_prime_field)\n\t\t{\n\t\tif ((tmp = BN_new()) == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (!EC_GROUP_get_curve_GFp(group, tmp, NULL, NULL, NULL))\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_EC_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tfield->p.prime = BN_to_ASN1_INTEGER(tmp,NULL);\n\t\tif (field->p.prime == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_ASN1_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\tint\t\tfield_type;\n\t\tX9_62_CHARACTERISTIC_TWO *char_two;\n\t\tfield->p.char_two = X9_62_CHARACTERISTIC_TWO_new();\n\t\tchar_two = field->p.char_two;\n\t\tif (char_two == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\tchar_two->m = (long)EC_GROUP_get_degree(group);\n\t\tfield_type = EC_GROUP_get_basis_type(group);\n\t\tif (field_type == 0)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_EC_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif ((char_two->type = OBJ_nid2obj(field_type)) == NULL)\n\t\t\t{\n\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_OBJ_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (field_type == NID_X9_62_tpBasis)\n\t\t\t{\n\t\t\tunsigned int k;\n\t\t\tif (!EC_GROUP_get_trinomial_basis(group, &k))\n\t\t\t\tgoto err;\n\t\t\tchar_two->p.tpBasis = ASN1_INTEGER_new();\n\t\t\tif (!char_two->p.tpBasis)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tif (!ASN1_INTEGER_set(char_two->p.tpBasis, (long)k))\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID,\n\t\t\t\t\tERR_R_ASN1_LIB);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\telse if (field_type == NID_X9_62_ppBasis)\n\t\t\t{\n\t\t\tunsigned int k1, k2, k3;\n\t\t\tif (!EC_GROUP_get_pentanomial_basis(group, &k1, &k2, &k3))\n\t\t\t\tgoto err;\n\t\t\tchar_two->p.ppBasis = X9_62_PENTANOMIAL_new();\n\t\t\tif (!char_two->p.ppBasis)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\tchar_two->p.ppBasis->k1 = (long)k1;\n\t\t\tchar_two->p.ppBasis->k2 = (long)k2;\n\t\t\tchar_two->p.ppBasis->k3 = (long)k3;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tchar_two->p.onBasis = ASN1_NULL_new();\n\t\t\tif (!char_two->p.onBasis)\n\t\t\t\t{\n\t\t\t\tECerr(EC_F_EC_ASN1_GROUP2FIELDID, ERR_R_MALLOC_FAILURE);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tok = 1;\nerr :\tif (tmp)\n\t\tBN_free(tmp);\n\treturn(ok);\n}', 'BIGNUM *BN_new(void)\n\t{\n\tBIGNUM *ret;\n\tif ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)\n\t\t{\n\t\tBNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->flags=BN_FLG_MALLOCED;\n\tret->top=0;\n\tret->neg=0;\n\tret->dmax=0;\n\tret->d=NULL;\n\tbn_check_top(ret);\n\treturn(ret);\n\t}', 'ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)\n\t{\n\tASN1_INTEGER *ret;\n\tsize_t len,j;\n\tif (ai == NULL)\n\t\tret=M_ASN1_INTEGER_new();\n\telse\n\t\tret=ai;\n\tif (ret == NULL)\n\t\t{\n\t\tASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_NESTED_ASN1_ERROR);\n\t\tgoto err;\n\t\t}\n\tif (BN_is_negative(bn))\n\t\tret->type = V_ASN1_NEG_INTEGER;\n\telse ret->type=V_ASN1_INTEGER;\n\tj=BN_num_bits(bn);\n\tlen=((j == 0)?0:((j/8)+1));\n\tif (ret->length < len+4)\n\t\t{\n\t\tunsigned char *new_data=OPENSSL_realloc(ret->data, len+4U);\n\t\tif (!new_data)\n\t\t\t{\n\t\t\tASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\tret->data=new_data;\n\t\t}\n\tret->length=BN_bn2bin(bn,ret->data);\n\tif(!ret->length)\n\t\t{\n\t\tret->data[0] = 0;\n\t\tret->length = 1;\n\t\t}\n\treturn(ret);\nerr:\n\tif (ret != ai) M_ASN1_INTEGER_free(ret);\n\treturn(NULL);\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}']