crypto/bn/bntest.c:529: error: BUFFER_OVERRUN_L2
  Offset: [0, 18446744073709551615] Size: 256 by call to `BN_div_word`.
Showing all 12 steps of the trace


crypto/bn/bntest.c:528:3: Call
526.   		} while (!s);
527.   
528.   		BN_copy(&b, &a);
         ^
529.   		r = BN_div_word(&b, s);
530.   

crypto/bn/bn_lib.c:488:1: Parameter `*a->d`
  486.   	}
  487.   
  488. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
  489.   	{
  490.   	int i;

crypto/bn/bntest.c:525:4: Assignment
523.   			BN_bntest_rand(&a,512,-1,0);
524.   			BN_bntest_rand(&b,BN_BITS2,-1,0);
525.   			s = b.d[0];
          ^
526.   		} while (!s);
527.   

crypto/bn/bntest.c:529:7: Call
527.   
528.   		BN_copy(&b, &a);
529.   		r = BN_div_word(&b, s);
             ^
530.   
531.   		if (bp != NULL)

crypto/bn/bn_word.c:89:1: Parameter `w`
  87.   	}
  88.   
  89. > BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)
  90.   	{
  91.   	BN_ULONG ret = 0;

crypto/bn/bn_word.c:95:2: Assignment
  93.   
  94.   	bn_check_top(a);
  95.   	w &= BN_MASK2;
         ^
  96.   
  97.   	if (!w)

crypto/bn/bn_word.c:104:17: Call
  102.   
  103.   	/* normalize input (so bn_div_words doesn't complain) */
  104.   	j = BN_BITS2 - BN_num_bits_word(w);
                         ^
  105.   	w <<= j;
  106.   	if (!BN_lshift(a, a, j))

crypto/bn/bn_lib.c:143:1: <Offset trace>
141.   	}
142.   
143. > int BN_num_bits_word(BN_ULONG l)
144.   	{
145.   	static const unsigned char bits[256]={

crypto/bn/bn_lib.c:143:1: Parameter `l`
    141.   	}
    142.   
    143. > int BN_num_bits_word(BN_ULONG l)
    144.   	{
    145.   	static const unsigned char bits[256]={

crypto/bn/bn_lib.c:145:2: <Length trace>
143.   int BN_num_bits_word(BN_ULONG l)
144.   	{
145.   	static const unsigned char bits[256]={
        ^
146.   		0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
147.   		5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,

crypto/bn/bn_lib.c:145:2: Array declaration
    143.   int BN_num_bits_word(BN_ULONG l)
    144.   	{
    145.   	static const unsigned char bits[256]={
            ^
    146.   		0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
    147.   		5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,

crypto/bn/bn_lib.c:171:12: Array access: Offset: [0, 18446744073709551615] Size: 256 by call to `BN_div_word` 
    169.   			if (l & 0xff00000000000000L)
    170.   				{
    171.   				return(bits[(int)(l>>56)]+56);
                      ^
    172.   				}
    173.   			else	return(bits[(int)(l>>48)]+48);

int BN_num_bits_word(BN_ULONG l)
	{
	static const unsigned char bits[256]={
		0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
		5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
		6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
		6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
		7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
		7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
		7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
		7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
		};
#if defined(SIXTY_FOUR_BIT_LONG)
	if (l & 0xffffffff00000000L)
		{
		if (l & 0xffff000000000000L)
			{
			if (l & 0xff00000000000000L)
				{
				return(bits[(int)(l>>56)]+56);
				}
			else	return(bits[(int)(l>>48)]+48);
			}
		else
			{
			if (l & 0x0000ff0000000000L)
				{
				return(bits[(int)(l>>40)]+40);
				}
			else	return(bits[(int)(l>>32)]+32);
			}
		}
	else
#else
#ifdef SIXTY_FOUR_BIT
	if (l & 0xffffffff00000000LL)
		{
		if (l & 0xffff000000000000LL)
			{
			if (l & 0xff00000000000000LL)
				{
				return(bits[(int)(l>>56)]+56);
				}
			else	return(bits[(int)(l>>48)]+48);
			}
		else
			{
			if (l & 0x0000ff0000000000LL)
				{
				return(bits[(int)(l>>40)]+40);
				}
			else	return(bits[(int)(l>>32)]+32);
			}
		}
	else
#endif
#endif
		{
#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
		if (l & 0xffff0000L)
			{
			if (l & 0xff000000L)
				return(bits[(int)(l>>24L)]+24);
			else	return(bits[(int)(l>>16L)]+16);
			}
		else
#endif
			{
#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
			if (l & 0xff00L)
				return(bits[(int)(l>>8)]+8);
			else
#endif
				return(bits[(int)(l   )]  );
			}
		}
	}
['int test_div_word(BIO *bp)\n\t{\n\tBIGNUM   a,b;\n\tBN_ULONG r,s;\n\tint i;\n\tBN_init(&a);\n\tBN_init(&b);\n\tfor (i=0; i<num0; i++)\n\t\t{\n\t\tdo {\n\t\t\tBN_bntest_rand(&a,512,-1,0);\n\t\t\tBN_bntest_rand(&b,BN_BITS2,-1,0);\n\t\t\ts = b.d[0];\n\t\t} while (!s);\n\t\tBN_copy(&b, &a);\n\t\tr = BN_div_word(&b, s);\n\t\tif (bp != NULL)\n\t\t\t{\n\t\t\tif (!results)\n\t\t\t\t{\n\t\t\t\tBN_print(bp,&a);\n\t\t\t\tBIO_puts(bp," / ");\n\t\t\t\tprint_word(bp,s);\n\t\t\t\tBIO_puts(bp," - ");\n\t\t\t\t}\n\t\t\tBN_print(bp,&b);\n\t\t\tBIO_puts(bp,"\\n");\n\t\t\tif (!results)\n\t\t\t\t{\n\t\t\t\tBN_print(bp,&a);\n\t\t\t\tBIO_puts(bp," % ");\n\t\t\t\tprint_word(bp,s);\n\t\t\t\tBIO_puts(bp," - ");\n\t\t\t\t}\n\t\t\tprint_word(bp,r);\n\t\t\tBIO_puts(bp,"\\n");\n\t\t\t}\n\t\tBN_mul_word(&b,s);\n\t\tBN_add_word(&b,r);\n\t\tBN_sub(&b,&a,&b);\n\t\tif(!BN_is_zero(&b))\n\t\t    {\n\t\t    fprintf(stderr,"Division (word) test failed!\\n");\n\t\t    return 0;\n\t\t    }\n\t\t}\n\tBN_free(&a);\n\tBN_free(&b);\n\treturn(1);\n\t}', 'BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)\n\t{\n\tint i;\n\tBN_ULONG *A;\n\tconst BN_ULONG *B;\n\tbn_check_top(b);\n\tif (a == b) return(a);\n\tif (bn_wexpand(a,b->top) == NULL) return(NULL);\n#if 1\n\tA=a->d;\n\tB=b->d;\n\tfor (i=b->top>>2; i>0; i--,A+=4,B+=4)\n\t\t{\n\t\tBN_ULONG a0,a1,a2,a3;\n\t\ta0=B[0]; a1=B[1]; a2=B[2]; a3=B[3];\n\t\tA[0]=a0; A[1]=a1; A[2]=a2; A[3]=a3;\n\t\t}\n\tswitch (b->top&3)\n\t\t{\n\t\tcase 3: A[2]=B[2];\n\t\tcase 2: A[1]=B[1];\n\t\tcase 1: A[0]=B[0];\n\t\tcase 0: ;\n\t\t}\n#else\n\tmemcpy(a->d,b->d,sizeof(b->d[0])*b->top);\n#endif\n\ta->top=b->top;\n\ta->neg=b->neg;\n\tbn_check_top(a);\n\treturn(a);\n\t}', 'BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)\n\t{\n\tBN_ULONG ret = 0;\n\tint i, j;\n\tbn_check_top(a);\n\tw &= BN_MASK2;\n\tif (!w)\n\t\treturn (BN_ULONG)-1;\n\tif (a->top == 0)\n\t\treturn 0;\n\tj = BN_BITS2 - BN_num_bits_word(w);\n\tw <<= j;\n\tif (!BN_lshift(a, a, j))\n\t\treturn (BN_ULONG)-1;\n\tfor (i=a->top-1; i>=0; i--)\n\t\t{\n\t\tBN_ULONG l,d;\n\t\tl=a->d[i];\n\t\td=bn_div_words(ret,l,w);\n\t\tret=(l-((d*w)&BN_MASK2))&BN_MASK2;\n\t\ta->d[i]=d;\n\t\t}\n\tif ((a->top > 0) && (a->d[a->top-1] == 0))\n\t\ta->top--;\n\tret >>= j;\n\tbn_check_top(a);\n\treturn(ret);\n\t}', 'int BN_num_bits_word(BN_ULONG l)\n\t{\n\tstatic const unsigned char bits[256]={\n\t\t0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,\n\t\t5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n\t\t6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n\t\t6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n\t\t7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n\t\t7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n\t\t7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n\t\t7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,\n\t\t};\n#if defined(SIXTY_FOUR_BIT_LONG)\n\tif (l & 0xffffffff00000000L)\n\t\t{\n\t\tif (l & 0xffff000000000000L)\n\t\t\t{\n\t\t\tif (l & 0xff00000000000000L)\n\t\t\t\t{\n\t\t\t\treturn(bits[(int)(l>>56)]+56);\n\t\t\t\t}\n\t\t\telse\treturn(bits[(int)(l>>48)]+48);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tif (l & 0x0000ff0000000000L)\n\t\t\t\t{\n\t\t\t\treturn(bits[(int)(l>>40)]+40);\n\t\t\t\t}\n\t\t\telse\treturn(bits[(int)(l>>32)]+32);\n\t\t\t}\n\t\t}\n\telse\n#else\n#ifdef SIXTY_FOUR_BIT\n\tif (l & 0xffffffff00000000LL)\n\t\t{\n\t\tif (l & 0xffff000000000000LL)\n\t\t\t{\n\t\t\tif (l & 0xff00000000000000LL)\n\t\t\t\t{\n\t\t\t\treturn(bits[(int)(l>>56)]+56);\n\t\t\t\t}\n\t\t\telse\treturn(bits[(int)(l>>48)]+48);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tif (l & 0x0000ff0000000000LL)\n\t\t\t\t{\n\t\t\t\treturn(bits[(int)(l>>40)]+40);\n\t\t\t\t}\n\t\t\telse\treturn(bits[(int)(l>>32)]+32);\n\t\t\t}\n\t\t}\n\telse\n#endif\n#endif\n\t\t{\n#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)\n\t\tif (l & 0xffff0000L)\n\t\t\t{\n\t\t\tif (l & 0xff000000L)\n\t\t\t\treturn(bits[(int)(l>>24L)]+24);\n\t\t\telse\treturn(bits[(int)(l>>16L)]+16);\n\t\t\t}\n\t\telse\n#endif\n\t\t\t{\n#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)\n\t\t\tif (l & 0xff00L)\n\t\t\t\treturn(bits[(int)(l>>8)]+8);\n\t\t\telse\n#endif\n\t\t\t\treturn(bits[(int)(l   )]  );\n\t\t\t}\n\t\t}\n\t}']