crypto/rsa/rsa_eay.c:206: error: BUFFER_OVERRUN_L3
  Offset: [-2, +oo] Size: 12 by call to `RSA_blinding_on`.
Showing all 12 steps of the trace


crypto/rsa/rsa_eay.c:180:11: Call
178.   	BN_init(&ret);
179.   
180.   	if ((ctx=BN_CTX_new()) == NULL) goto err;
                 ^
181.   	num=BN_num_bytes(rsa->n);
182.   	if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)

crypto/bn/bn_ctx.c:79:2: Call
  77.   		}
  78.   
  79.   	BN_CTX_init(ret);
         ^
  80.   	ret->flags=BN_FLG_MALLOCED;
  81.   	return(ret);

crypto/bn/bn_ctx.c:89:2: Assignment
    87.   	ctx->tos = 0;
    88.   	ctx->flags = 0;
    89.   	ctx->depth = 0;
           ^
    90.   	ctx->too_many = 0;
    91.   	for (i = 0; i < BN_CTX_NUM; i++)

crypto/rsa/rsa_eay.c:206:3: Call
204.   
205.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
206.   		RSA_blinding_on(rsa,ctx);
         ^
207.   	if (rsa->flags & RSA_FLAG_BLINDING)
208.   		if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;

crypto/rsa/rsa_lib.c:257:1: Parameter `p_ctx->depth`
  255.   	}
  256.   
  257. > int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
  258.   	{
  259.   	BIGNUM *A,*Ai;

crypto/rsa/rsa_lib.c:285:2: Call
  283.   	ret=1;
  284.   err:
  285.   	BN_CTX_end(ctx);
          ^
  286.   	if (ctx != p_ctx) BN_CTX_free(ctx);
  287.   	return(ret);

crypto/bn/bn_ctx.c:130:1: <Offset trace>
128.   	}
129.   
130. > void BN_CTX_end(BN_CTX *ctx)
131.   	{
132.   	if (ctx == NULL) return;

crypto/bn/bn_ctx.c:130:1: Parameter `ctx->depth`
    128.   	}
    129.   
    130. > void BN_CTX_end(BN_CTX *ctx)
    131.   	{
    132.   	if (ctx == NULL) return;

crypto/bn/bn_ctx.c:141:2: Assignment
    139.   
    140.   	ctx->too_many = 0;
    141.   	ctx->depth--;
            ^
    142.   	if (ctx->depth < BN_CTX_NUM_POS)
    143.   		ctx->tos = ctx->pos[ctx->depth];

crypto/bn/bn_ctx.c:130:1: <Length trace>
128.   	}
129.   
130. > void BN_CTX_end(BN_CTX *ctx)
131.   	{
132.   	if (ctx == NULL) return;

crypto/bn/bn_ctx.c:130:1: Parameter `ctx->pos[*]`
    128.   	}
    129.   
    130. > void BN_CTX_end(BN_CTX *ctx)
    131.   	{
    132.   	if (ctx == NULL) return;

crypto/bn/bn_ctx.c:143:14: Array access: Offset: [-2, +oo] Size: 12 by call to `RSA_blinding_on` 
    141.   	ctx->depth--;
    142.   	if (ctx->depth < BN_CTX_NUM_POS)
    143.   		ctx->tos = ctx->pos[ctx->depth];
                        ^
    144.   	}

void BN_CTX_end(BN_CTX *ctx)
	{
	if (ctx == NULL) return;
	assert(ctx->depth > 0);
	if (ctx->depth == 0)
		BN_CTX_start(ctx);
	ctx->too_many = 0;
	ctx->depth--;
	if (ctx->depth < BN_CTX_NUM_POS)
		ctx->tos = ctx->pos[ctx->depth];
	}
['static int RSA_eay_private_encrypt(int flen, unsigned char *from,\n\t     unsigned char *to, RSA *rsa, int padding)\n\t{\n\tBIGNUM f,ret;\n\tint i,j,k,num=0,r= -1;\n\tunsigned char *buf=NULL;\n\tBN_CTX *ctx=NULL;\n\tBN_init(&f);\n\tBN_init(&ret);\n\tif ((ctx=BN_CTX_new()) == NULL) goto err;\n\tnum=BN_num_bytes(rsa->n);\n\tif ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tswitch (padding)\n\t\t{\n\tcase RSA_PKCS1_PADDING:\n\t\ti=RSA_padding_add_PKCS1_type_1(buf,num,from,flen);\n\t\tbreak;\n\tcase RSA_NO_PADDING:\n\t\ti=RSA_padding_add_none(buf,num,from,flen);\n\t\tbreak;\n\tcase RSA_SSLV23_PADDING:\n\tdefault:\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,RSA_R_UNKNOWN_PADDING_TYPE);\n\t\tgoto err;\n\t\t}\n\tif (i <= 0) goto err;\n\tif (BN_bin2bn(buf,num,&f) == NULL) goto err;\n\tif ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))\n\t\tRSA_blinding_on(rsa,ctx);\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;\n\tif ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||\n\t\t((rsa->p != NULL) &&\n\t\t(rsa->q != NULL) &&\n\t\t(rsa->dmp1 != NULL) &&\n\t\t(rsa->dmq1 != NULL) &&\n\t\t(rsa->iqmp != NULL)) )\n\t\t{ if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }\n\telse\n\t\t{\n\t\tif (!rsa->meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL)) goto err;\n\t\t}\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;\n\tj=BN_num_bytes(&ret);\n\ti=BN_bn2bin(&ret,&(to[num-j]));\n\tfor (k=0; k<(num-i); k++)\n\t\tto[k]=0;\n\tr=num;\nerr:\n\tif (ctx != NULL) BN_CTX_free(ctx);\n\tBN_clear_free(&ret);\n\tBN_clear_free(&f);\n\tif (buf != NULL)\n\t\t{\n\t\tmemset(buf,0,num);\n\t\tOPENSSL_free(buf);\n\t\t}\n\treturn(r);\n\t}', 'BN_CTX *BN_CTX_new(void)\n\t{\n\tBN_CTX *ret;\n\tret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));\n\tif (ret == NULL)\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tBN_CTX_init(ret);\n\tret->flags=BN_FLG_MALLOCED;\n\treturn(ret);\n\t}', 'void BN_CTX_init(BN_CTX *ctx)\n\t{\n\tint i;\n\tctx->tos = 0;\n\tctx->flags = 0;\n\tctx->depth = 0;\n\tctx->too_many = 0;\n\tfor (i = 0; i < BN_CTX_NUM; i++)\n\t\tBN_init(&(ctx->bn[i]));\n\t}', 'int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)\n\t{\n\tBIGNUM *A,*Ai;\n\tBN_CTX *ctx;\n\tint ret=0;\n\tif (p_ctx == NULL)\n\t\t{\n\t\tif ((ctx=BN_CTX_new()) == NULL) goto err;\n\t\t}\n\telse\n\t\tctx=p_ctx;\n\tif (rsa->blinding != NULL)\n\t\tBN_BLINDING_free(rsa->blinding);\n\tBN_CTX_start(ctx);\n\tA = BN_CTX_get(ctx);\n\tif (!BN_rand(A,BN_num_bits(rsa->n)-1,1,0)) goto err;\n\tif ((Ai=BN_mod_inverse(NULL,A,rsa->n,ctx)) == NULL) goto err;\n\tif (!rsa->meth->bn_mod_exp(A,A,rsa->e,rsa->n,ctx,rsa->_method_mod_n))\n\t    goto err;\n\trsa->blinding=BN_BLINDING_new(A,Ai,rsa->n);\n\trsa->flags|=RSA_FLAG_BLINDING;\n\tBN_free(Ai);\n\tret=1;\nerr:\n\tBN_CTX_end(ctx);\n\tif (ctx != p_ctx) BN_CTX_free(ctx);\n\treturn(ret);\n\t}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tif (ctx == NULL) return;\n\tassert(ctx->depth > 0);\n\tif (ctx->depth == 0)\n\t\tBN_CTX_start(ctx);\n\tctx->too_many = 0;\n\tctx->depth--;\n\tif (ctx->depth < BN_CTX_NUM_POS)\n\t\tctx->tos = ctx->pos[ctx->depth];\n\t}']