crypto/bn/bn_add.c:86: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `BN_usub`.
Showing all 8 steps of the trace


crypto/bn/bn_add.c:64:1: Parameter `*b->d`
62.   
63.   /* r can == a or b */
64. > int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b)
65.   	{
66.   	BIGNUM *tmp;

crypto/bn/bn_add.c:84:7: Call
82.   		/* we are now a - b */
83.   
84.   		if (BN_ucmp(a,b) < 0)
            ^
85.   			{
86.   			if (!BN_usub(r,b,a)) return(0);

crypto/bn/bn_lib.c:646:1: Parameter `*b->d`
  644.   	}
  645.   
  646. > int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
  647.   	{
  648.   	int i;

crypto/bn/bn_add.c:86:9: Call
84.   		if (BN_ucmp(a,b) < 0)
85.   			{
86.   			if (!BN_usub(r,b,a)) return(0);
              ^
87.   			r->neg=1;
88.   			}

crypto/bn/bn_add.c:167:1: <LHS trace>
165.   
166.   /* unsigned subtraction of b from a, a must be larger than b. */
167. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
168.   	{
169.   	int max,min;

crypto/bn/bn_add.c:167:1: Parameter `*a->d`
  165.   
  166.   /* unsigned subtraction of b from a, a must be larger than b. */
  167. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
  168.   	{
  169.   	int max,min;

crypto/bn/bn_add.c:226:4: Assignment
  224.   			{
  225.   			i++;
  226.   			t1= *(ap++);
            ^
  227.   			t2=(t1-1)&BN_MASK2;
  228.   			*(rp++)=t2;

crypto/bn/bn_add.c:227:4: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BN_usub` 
  225.   			i++;
  226.   			t1= *(ap++);
  227.   			t2=(t1-1)&BN_MASK2;
            ^
  228.   			*(rp++)=t2;
  229.   			if (t1 > t2) break;

int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
	{
	int max,min;
	register BN_ULONG t1,t2,*ap,*bp,*rp;
	int i,carry;
#if defined(IRIX_CC_BUG) && !defined(LINT)
	int dummy;
#endif
	bn_check_top(a);
	bn_check_top(b);
	if (a->top < b->top)
		{
		BNerr(BN_F_BN_USUB,BN_R_ARG2_LT_ARG3);
		return(0);
		}
	max=a->top;
	min=b->top;
	if (bn_wexpand(r,max) == NULL) return(0);
	ap=a->d;
	bp=b->d;
	rp=r->d;
#if 1
	carry=0;
	for (i=0; i<min; i++)
		{
		t1= *(ap++);
		t2= *(bp++);
		if (carry)
			{
			carry=(t1 <= t2);
			t1=(t1-t2-1)&BN_MASK2;
			}
		else
			{
			carry=(t1 < t2);
			t1=(t1-t2)&BN_MASK2;
			}
#if defined(IRIX_CC_BUG) && !defined(LINT)
		dummy=t1;
#endif
		*(rp++)=t1&BN_MASK2;
		}
#else
	carry=bn_sub_words(rp,ap,bp,min);
	ap+=min;
	bp+=min;
	rp+=min;
	i=min;
#endif
	if (carry)
		{
		while (i < max)
			{
			i++;
			t1= *(ap++);
			t2=(t1-1)&BN_MASK2;
			*(rp++)=t2;
			if (t1 > t2) break;
			}
		}
#if 0
	memcpy(rp,ap,sizeof(*rp)*(max-i));
#else
	if (rp != ap)
		{
		for (;;)
			{
			if (i++ >= max) break;
			rp[0]=ap[0];
			if (i++ >= max) break;
			rp[1]=ap[1];
			if (i++ >= max) break;
			rp[2]=ap[2];
			if (i++ >= max) break;
			rp[3]=ap[3];
			rp+=4;
			ap+=4;
			}
		}
#endif
	r->top=max;
	bn_fix_top(r);
	return(1);
	}
['int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b)\n\t{\n\tBIGNUM *tmp;\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tif (a->neg ^ b->neg)\n\t\t{\n\t\tif (a->neg)\n\t\t\t{ tmp=a; a=b; b=tmp; }\n\t\tif (BN_ucmp(a,b) < 0)\n\t\t\t{\n\t\t\tif (!BN_usub(r,b,a)) return(0);\n\t\t\tr->neg=1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tif (!BN_usub(r,a,b)) return(0);\n\t\t\tr->neg=0;\n\t\t\t}\n\t\treturn(1);\n\t\t}\n\tif (a->neg)\n\t\tr->neg=1;\n\telse\n\t\tr->neg=0;\n\tif (!BN_uadd(r,a,b)) return(0);\n\treturn(1);\n\t}', 'int BN_ucmp(const BIGNUM *a, const BIGNUM *b)\n\t{\n\tint i;\n\tBN_ULONG t1,t2,*ap,*bp;\n\tbn_check_top(a);\n\tbn_check_top(b);\n\ti=a->top-b->top;\n\tif (i != 0) return(i);\n\tap=a->d;\n\tbp=b->d;\n\tfor (i=a->top-1; i>=0; i--)\n\t\t{\n\t\tt1= ap[i];\n\t\tt2= bp[i];\n\t\tif (t1 != t2)\n\t\t\treturn(t1 > t2?1:-1);\n\t\t}\n\treturn(0);\n\t}', 'int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)\n\t{\n\tint max,min;\n\tregister BN_ULONG t1,t2,*ap,*bp,*rp;\n\tint i,carry;\n#if defined(IRIX_CC_BUG) && !defined(LINT)\n\tint dummy;\n#endif\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tif (a->top < b->top)\n\t\t{\n\t\tBNerr(BN_F_BN_USUB,BN_R_ARG2_LT_ARG3);\n\t\treturn(0);\n\t\t}\n\tmax=a->top;\n\tmin=b->top;\n\tif (bn_wexpand(r,max) == NULL) return(0);\n\tap=a->d;\n\tbp=b->d;\n\trp=r->d;\n#if 1\n\tcarry=0;\n\tfor (i=0; i<min; i++)\n\t\t{\n\t\tt1= *(ap++);\n\t\tt2= *(bp++);\n\t\tif (carry)\n\t\t\t{\n\t\t\tcarry=(t1 <= t2);\n\t\t\tt1=(t1-t2-1)&BN_MASK2;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tcarry=(t1 < t2);\n\t\t\tt1=(t1-t2)&BN_MASK2;\n\t\t\t}\n#if defined(IRIX_CC_BUG) && !defined(LINT)\n\t\tdummy=t1;\n#endif\n\t\t*(rp++)=t1&BN_MASK2;\n\t\t}\n#else\n\tcarry=bn_sub_words(rp,ap,bp,min);\n\tap+=min;\n\tbp+=min;\n\trp+=min;\n\ti=min;\n#endif\n\tif (carry)\n\t\t{\n\t\twhile (i < max)\n\t\t\t{\n\t\t\ti++;\n\t\t\tt1= *(ap++);\n\t\t\tt2=(t1-1)&BN_MASK2;\n\t\t\t*(rp++)=t2;\n\t\t\tif (t1 > t2) break;\n\t\t\t}\n\t\t}\n#if 0\n\tmemcpy(rp,ap,sizeof(*rp)*(max-i));\n#else\n\tif (rp != ap)\n\t\t{\n\t\tfor (;;)\n\t\t\t{\n\t\t\tif (i++ >= max) break;\n\t\t\trp[0]=ap[0];\n\t\t\tif (i++ >= max) break;\n\t\t\trp[1]=ap[1];\n\t\t\tif (i++ >= max) break;\n\t\t\trp[2]=ap[2];\n\t\t\tif (i++ >= max) break;\n\t\t\trp[3]=ap[3];\n\t\t\trp+=4;\n\t\t\tap+=4;\n\t\t\t}\n\t\t}\n#endif\n\tr->top=max;\n\tbn_fix_top(r);\n\treturn(1);\n\t}']