crypto/rsa/rsa_eay.c:279: 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:256:6: Call
254.   	BN_init(&f);
255.   	BN_init(&ret);
256.   	ctx=BN_CTX_new();
            ^
257.   	if (ctx == NULL) goto err;
258.   

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:279:3: Call
277.   
278.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
279.   		RSA_blinding_on(rsa,ctx);
         ^
280.   	if (rsa->flags & RSA_FLAG_BLINDING)
281.   		if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;

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

crypto/rsa/rsa_lib.c:284:2: Call
  282.   	ret=1;
  283.   err:
  284.   	BN_CTX_end(ctx);
          ^
  285.   	if (ctx != p_ctx) BN_CTX_free(ctx);
  286.   	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_decrypt(int flen, unsigned char *from,\n\t     unsigned char *to, RSA *rsa, int padding)\n\t{\n\tBIGNUM f,ret;\n\tint j,num=0,r= -1;\n\tunsigned char *p;\n\tunsigned char *buf=NULL;\n\tBN_CTX *ctx=NULL;\n\tBN_init(&f);\n\tBN_init(&ret);\n\tctx=BN_CTX_new();\n\tif (ctx == NULL) goto err;\n\tnum=BN_num_bytes(rsa->n);\n\tif ((buf=(unsigned char *)Malloc(num)) == NULL)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (flen > num)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);\n\t\tgoto err;\n\t\t}\n\tif (BN_bin2bn(from,(int)flen,&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))\n\t\t\tgoto err;\n\t\t}\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;\n\tp=buf;\n\tj=BN_bn2bin(&ret,p);\n\tswitch (padding)\n\t\t{\n\tcase RSA_PKCS1_PADDING:\n\t\tr=RSA_padding_check_PKCS1_type_2(to,num,buf,j,num);\n\t\tbreak;\n#ifndef NO_SHA\n        case RSA_PKCS1_OAEP_PADDING:\n\t        r=RSA_padding_check_PKCS1_OAEP(to,num,buf,j,num,NULL,0);\n                break;\n#endif\n \tcase RSA_SSLV23_PADDING:\n\t\tr=RSA_padding_check_SSLv23(to,num,buf,j,num);\n\t\tbreak;\n\tcase RSA_NO_PADDING:\n\t\tr=RSA_padding_check_none(to,num,buf,j,num);\n\t\tbreak;\n\tdefault:\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_UNKNOWN_PADDING_TYPE);\n\t\tgoto err;\n\t\t}\n\tif (r < 0)\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_PADDING_CHECK_FAILED);\nerr:\n\tif (ctx != NULL) BN_CTX_free(ctx);\n\tBN_clear_free(&f);\n\tBN_clear_free(&ret);\n\tif (buf != NULL)\n\t\t{\n\t\tmemset(buf,0,num);\n\t\tFree(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 *)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}']