crypto/bn/bn_mont.c:388: error: BUFFER_OVERRUN_S2
  Offset: [3+min(0, `mont->RR.top`), +oo] (⇐ [min(0, `mont->RR.top`), +oo] + 3) Size: [1+min(0, `mont->RR.top`), +oo] by call to `BN_mod`.
Showing all 22 steps of the trace


crypto/bn/bn_mont.c:301:1: Parameter `mont->RR.top`
299.   	}
300.   
301. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, BIGNUM *mod, BN_CTX *ctx)
302.   	{
303.   	BIGNUM Ri,*R;

crypto/bn/bn_mont.c:319:3: Call
317.   
318.   		mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2;
319.   		BN_zero(R);
         ^
320.   		BN_set_bit(R,BN_BITS2);
321.   		/* I was bad, this modification of a passed variable was

crypto/bn/bn_lib.c:548:1: Parameter `a->top`
  546.   	}
  547.   
  548. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  549.   	{
  550.   	int i,n;

crypto/bn/bn_mont.c:320:3: Call
318.   		mont->ri=(BN_num_bits(mod)+(BN_BITS2-1))/BN_BITS2*BN_BITS2;
319.   		BN_zero(R);
320.   		BN_set_bit(R,BN_BITS2);
         ^
321.   		/* I was bad, this modification of a passed variable was
322.   		 * breaking the multithreaded stuff :-(

crypto/bn/bn_lib.c:688:1: Parameter `a->top`
  686.   	}
  687.   
  688. > int BN_set_bit(BIGNUM *a, int n)
  689.   	{
  690.   	int i,j,k;

crypto/bn/bn_mont.c:333:8: Call
331.   		tmod.neg=mod->neg;
332.   
333.   		if ((BN_mod_inverse(&Ri,R,&tmod,ctx)) == NULL)
              ^
334.   			goto err;
335.   		BN_lshift(&Ri,&Ri,BN_BITS2);			/* R*Ri */

crypto/bn/bn_gcd.c:148:1: Parameter `a->top`
  146.   
  147.   /* solves ax == 1 (mod n) */
  148. > BIGNUM *BN_mod_inverse(BIGNUM *in, BIGNUM *a, BIGNUM *n, BN_CTX *ctx)
  149.   	{
  150.   	BIGNUM *A,*B,*X,*Y,*M,*D,*R;

crypto/bn/bn_mont.c:383:2: Call
381.   	/* setup RR for conversions */
382.   #if 1
383.   	BN_zero(&(mont->RR));
        ^
384.   	BN_set_bit(&(mont->RR),mont->ri*2);
385.   #else

crypto/bn/bn_lib.c:548:1: Parameter `a->top`
  546.   	}
  547.   
  548. > int BN_set_word(BIGNUM *a, BN_ULONG w)
  549.   	{
  550.   	int i,n;

crypto/bn/bn_mont.c:384:2: Call
382.   #if 1
383.   	BN_zero(&(mont->RR));
384.   	BN_set_bit(&(mont->RR),mont->ri*2);
        ^
385.   #else
386.   	BN_lshift(mont->RR,BN_value_one(),mont->ri*2);

crypto/bn/bn_lib.c:688:1: Parameter `a->top`
  686.   	}
  687.   
  688. > int BN_set_bit(BIGNUM *a, int n)
  689.   	{
  690.   	int i,j,k;

crypto/bn/bn_mont.c:388:2: Call
386.   	BN_lshift(mont->RR,BN_value_one(),mont->ri*2);
387.   #endif
388.   	BN_mod(&(mont->RR),&(mont->RR),&(mont->N),ctx);
        ^
389.   
390.   	return(1);

crypto/bn/bn_div.c:286:1: Parameter `rem->top`
  284.   
  285.   /* rem != m */
  286. > int BN_mod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx)
  287.   	{
  288.   #if 0 /* The old slow way */

crypto/bn/bn_div.c:312:9: Call
  310.   	return(1);
  311.   #else
  312.   	return(BN_div(NULL,rem,m,d,ctx));
                 ^
  313.   #endif
  314.   	}

crypto/bn/bn_div.c:120:1: Parameter `rm->top`
    118.   #else
    119.   
    120. > int BN_div(BIGNUM *dv, BIGNUM *rm, BIGNUM *num, BIGNUM *divisor,
    121.   	     BN_CTX *ctx)
    122.   	{

crypto/bn/bn_div.c:141:10: Call
    139.   		{
    140.   		if (rm != NULL)
    141.   			{ if (BN_copy(rm,num) == NULL) return(0); }
                    ^
    142.   		if (dv != NULL) BN_zero(dv);
    143.   		return(1);

crypto/bn/bn_lib.c:454:1: Parameter `a->max`
      452.   	}
      453.   
      454. > BIGNUM *BN_copy(BIGNUM *a, BIGNUM *b)
      455.   	{
      456.   	int i;

crypto/bn/bn_lib.c:462:6: Call
      460.   
      461.   	if (a == b) return(a);
      462.   	if (bn_wexpand(a,b->top) == NULL) return(NULL);
                  ^
      463.   
      464.   #if 1

crypto/bn/bn_lib.c:344:1: <Length trace>
342.   	}
343.   
344. > BIGNUM *bn_expand2(BIGNUM *b, int words)
345.   	{
346.   	BN_ULONG *A,*B,*a;

crypto/bn/bn_lib.c:344:1: Parameter `b->top`
        342.   	}
        343.   
        344. > BIGNUM *bn_expand2(BIGNUM *b, int words)
        345.   	{
        346.   	BN_ULONG *A,*B,*a;

crypto/bn/bn_lib.c:418:3: Assignment
        416.   		/* Now need to zero any data between b->top and b->max */
        417.   
        418.   		B= &(b->d[b->top]);
                 ^
        419.   		j=(b->max - b->top) & ~7;
        420.   		for (i=0; i<j; i+=8)

crypto/bn/bn_lib.c:422:28: Array access: Offset: [3+min(0, mont->RR.top), +oo] (⇐ [min(0, mont->RR.top), +oo] + 3) Size: [1+min(0, mont->RR.top), +oo] by call to `BN_mod` 
        420.   		for (i=0; i<j; i+=8)
        421.   			{
        422.   			B[0]=0; B[1]=0; B[2]=0; B[3]=0;
                                          ^
        423.   			B[4]=0; B[5]=0; B[6]=0; B[7]=0;
        424.   			B+=8;
