crypto/rsa/rsa_eay.c:386: error: NULL_DEREFERENCE
  pointer `meth` last assigned on line 355 could be null and is dereferenced at line 386, column 7.
Showing all 67 steps of the trace


crypto/rsa/rsa_eay.c:345:1: start of procedure RSA_eay_public_decrypt()
343.   	}
344.   
345. > static int RSA_eay_public_decrypt(int flen, const unsigned char *from,
346.   	     unsigned char *to, RSA *rsa, int padding)
347.   	{

crypto/rsa/rsa_eay.c:350:2: 
348.   	const RSA_METHOD *meth;
349.   	BIGNUM f,ret;
350. > 	int i,num=0,r= -1;
351.   	unsigned char *p;
352.   	unsigned char *buf=NULL;

crypto/rsa/rsa_eay.c:352:2: 
350.   	int i,num=0,r= -1;
351.   	unsigned char *p;
352. > 	unsigned char *buf=NULL;
353.   	BN_CTX *ctx=NULL;
354.   

crypto/rsa/rsa_eay.c:353:2: 
351.   	unsigned char *p;
352.   	unsigned char *buf=NULL;
353. > 	BN_CTX *ctx=NULL;
354.   
355.   	meth = ENGINE_get_RSA(rsa->engine);

crypto/rsa/rsa_eay.c:355:2: 
353.   	BN_CTX *ctx=NULL;
354.   
355. > 	meth = ENGINE_get_RSA(rsa->engine);
356.   	BN_init(&f);
357.   	BN_init(&ret);

crypto/engine/engine_list.c:563:1: start of procedure ENGINE_get_RSA()
  561.   	}
  562.   
  563. > const RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  564.   	{
  565.   	if(e == NULL)

crypto/engine/engine_list.c:565:5: Taking true branch
  563.   const RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  564.   	{
  565.   	if(e == NULL)
             ^
  566.   		{
  567.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,

crypto/engine/engine_list.c:567:3: 
  565.   	if(e == NULL)
  566.   		{
  567. > 		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  568.   			ERR_R_PASSED_NULL_PARAMETER);
  569.   		return NULL;

crypto/err/err.c:355:1: start of procedure ERR_put_error()
    353.   /********************************************************/
    354.   
    355. > void ERR_put_error(int lib, int func, int reason, const char *file,
    356.   	     int line)
    357.   	{

crypto/err/err.c:379:2: Skipping ERR_get_state(): empty list of specs
    377.   	}
    378.   #endif
    379.   	es=ERR_get_state();
            ^
    380.   
    381.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:381:2: 
    379.   	es=ERR_get_state();
    380.   
    381. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    382.   	if (es->top == es->bottom)
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:382:6: Taking false branch
    380.   
    381.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    382.   	if (es->top == es->bottom)
                ^
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:384:2: 
    382.   	if (es->top == es->bottom)
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;

crypto/err/err.c:385:2: 
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385. > 	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);

crypto/err/err.c:386:2: 
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385.   	es->err_file[es->top]=file;
    386. > 	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
    388.   	}

crypto/err/err.c:387:2: Taking true branch
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
            ^
    388.   	}
    389.   

crypto/err/err.c:387:2: Taking false branch
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
            ^
    388.   	}
    389.   

crypto/err/err.c:388:2: return from a call to ERR_put_error
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
    388.   	}
            ^
    389.   
    390.   void ERR_clear_error(void)

crypto/engine/engine_list.c:569:3: 
  567.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  568.   			ERR_R_PASSED_NULL_PARAMETER);
  569. > 		return NULL;
  570.   		}
  571.   	return e->rsa_meth;

crypto/engine/engine_list.c:572:2: return from a call to ENGINE_get_RSA
  570.   		}
  571.   	return e->rsa_meth;
  572.   	}
          ^
  573.   
  574.   DSA_METHOD *ENGINE_get_DSA(ENGINE *e)

crypto/rsa/rsa_eay.c:356:2: 
354.   
355.   	meth = ENGINE_get_RSA(rsa->engine);
356. > 	BN_init(&f);
357.   	BN_init(&ret);
358.   	ctx=BN_CTX_new();

crypto/bn/bn_lib.c:285:1: start of procedure BN_init()
  283.   	}
  284.   
  285. > void BN_init(BIGNUM *a)
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));

crypto/bn/bn_lib.c:287:2: 
  285.   void BN_init(BIGNUM *a)
  286.   	{
  287. > 	memset(a,0,sizeof(BIGNUM));
  288.   	}
  289.   

crypto/bn/bn_lib.c:288:2: return from a call to BN_init
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));
  288.   	}
          ^
  289.   
  290.   BIGNUM *BN_new(void)

crypto/rsa/rsa_eay.c:357:2: 
355.   	meth = ENGINE_get_RSA(rsa->engine);
356.   	BN_init(&f);
357. > 	BN_init(&ret);
358.   	ctx=BN_CTX_new();
359.   	if (ctx == NULL) goto err;

crypto/bn/bn_lib.c:285:1: start of procedure BN_init()
  283.   	}
  284.   
  285. > void BN_init(BIGNUM *a)
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));

crypto/bn/bn_lib.c:287:2: 
  285.   void BN_init(BIGNUM *a)
  286.   	{
  287. > 	memset(a,0,sizeof(BIGNUM));
  288.   	}
  289.   

crypto/bn/bn_lib.c:288:2: return from a call to BN_init
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));
  288.   	}
          ^
  289.   
  290.   BIGNUM *BN_new(void)

crypto/rsa/rsa_eay.c:358:2: 
356.   	BN_init(&f);
357.   	BN_init(&ret);
358. > 	ctx=BN_CTX_new();
359.   	if (ctx == NULL) goto err;
360.   

crypto/bn/bn_ctx.c:68:1: start of procedure BN_CTX_new()
  66.   
  67.   
  68. > BN_CTX *BN_CTX_new(void)
  69.   	{
  70.   	BN_CTX *ret;

crypto/bn/bn_ctx.c:72:2: 
  70.   	BN_CTX *ret;
  71.   
  72. > 	ret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
  73.   	if (ret == NULL)
  74.   		{

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
    203.   	}
    204.   
    205. > void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207.   	void *ret = NULL;

crypto/mem.c:207:2: 
    205.   void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207. > 	void *ret = NULL;
    208.   
    209.   	allow_customize = 0;

crypto/mem.c:209:2: 
    207.   	void *ret = NULL;
    208.   
    209. > 	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
    211.   		{

crypto/mem.c:210:6: Taking false branch
    208.   
    209.   	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
                ^
    211.   		{
    212.   		allow_customize_debug = 0;

crypto/mem.c:215:2: Skipping __function_pointer__(): unresolved function pointer
    213.   		malloc_debug_func(NULL, num, file, line, 0);
    214.   		}
    215.   	ret = malloc_func(num);
            ^
    216.   #ifdef LEVITTE_DEBUG
    217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:219:6: Taking false branch
    217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
    218.   #endif
    219.   	if (malloc_debug_func != NULL)
                ^
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   

crypto/mem.c:222:2: 
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   
    222. > 	return ret;
    223.   	}
    224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
    221.   
    222.   	return ret;
    223.   	}
            ^
    224.   
    225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bn/bn_ctx.c:73:6: Taking false branch
  71.   
  72.   	ret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
  73.   	if (ret == NULL)
             ^
  74.   		{
  75.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);

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

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

crypto/bn/bn_ctx.c:81:2: 
  79.   	BN_CTX_init(ret);
  80.   	ret->flags=BN_FLG_MALLOCED;
  81. > 	return(ret);
  82.   	}
  83.   

crypto/bn/bn_ctx.c:82:2: return from a call to BN_CTX_new
  80.   	ret->flags=BN_FLG_MALLOCED;
  81.   	return(ret);
  82.   	}
         ^
  83.   
  84.   void BN_CTX_init(BN_CTX *ctx)

crypto/rsa/rsa_eay.c:359:6: Taking false branch
357.   	BN_init(&ret);
358.   	ctx=BN_CTX_new();
359.   	if (ctx == NULL) goto err;
            ^
360.   
361.   	num=BN_num_bytes(rsa->n);

crypto/rsa/rsa_eay.c:361:2: 
359.   	if (ctx == NULL) goto err;
360.   
361. > 	num=BN_num_bytes(rsa->n);
362.   	buf=(unsigned char *)OPENSSL_malloc(num);
363.   	if (buf == NULL)

crypto/bn/bn_lib.c:244:1: start of procedure BN_num_bits()
  242.   	}
  243.   
  244. > int BN_num_bits(const BIGNUM *a)
  245.   	{
  246.   	BN_ULONG l;

crypto/bn/bn_lib.c:251:6: Taking false branch
  249.   	bn_check_top(a);
  250.   
  251.   	if (a->top == 0) return(0);
              ^
  252.   	l=a->d[a->top-1];
  253.   	assert(l != 0);

crypto/bn/bn_lib.c:252:2: 
  250.   
  251.   	if (a->top == 0) return(0);
  252. > 	l=a->d[a->top-1];
  253.   	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:253:2: 
  251.   	if (a->top == 0) return(0);
  252.   	l=a->d[a->top-1];
  253. > 	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));

crypto/bn/bn_lib.c:254:2: 
  252.   	l=a->d[a->top-1];
  253.   	assert(l != 0);
  254. > 	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
  256.   	}

crypto/bn/bn_lib.c:255:2: Skipping BN_num_bits_word(): empty list of specs
  253.   	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
          ^
  256.   	}
  257.   

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
  256.   	}
          ^
  257.   
  258.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_eay.c:362:2: 
360.   
361.   	num=BN_num_bytes(rsa->n);
362. > 	buf=(unsigned char *)OPENSSL_malloc(num);
363.   	if (buf == NULL)
364.   		{

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
  203.   	}
  204.   
  205. > void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207.   	void *ret = NULL;

crypto/mem.c:207:2: 
  205.   void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207. > 	void *ret = NULL;
  208.   
  209.   	allow_customize = 0;

crypto/mem.c:209:2: 
  207.   	void *ret = NULL;
  208.   
  209. > 	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
  211.   		{

crypto/mem.c:210:6: Taking false branch
  208.   
  209.   	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
              ^
  211.   		{
  212.   		allow_customize_debug = 0;

crypto/mem.c:215:2: Skipping __function_pointer__(): unresolved function pointer
  213.   		malloc_debug_func(NULL, num, file, line, 0);
  214.   		}
  215.   	ret = malloc_func(num);
          ^
  216.   #ifdef LEVITTE_DEBUG
  217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:219:6: Taking false branch
  217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
  218.   #endif
  219.   	if (malloc_debug_func != NULL)
              ^
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   

crypto/mem.c:222:2: 
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   
  222. > 	return ret;
  223.   	}
  224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
  221.   
  222.   	return ret;
  223.   	}
          ^
  224.   
  225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_eay.c:363:6: Taking false branch
361.   	num=BN_num_bytes(rsa->n);
362.   	buf=(unsigned char *)OPENSSL_malloc(num);
363.   	if (buf == NULL)
            ^
364.   		{
365.   		RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_eay.c:371:6: Taking false branch
369.   	/* This check was for equality but PGP does evil things
370.   	 * and chops off the top '0' bytes */
371.   	if (flen > num)
            ^
372.   		{
373.   		RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);

crypto/rsa/rsa_eay.c:377:6: Taking false branch
375.   		}
376.   
377.   	if (BN_bin2bn(from,flen,&f) == NULL) goto err;
            ^
378.   	/* do the decrypt */
379.   	if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC))

crypto/rsa/rsa_eay.c:379:7: Taking false branch
377.   	if (BN_bin2bn(from,flen,&f) == NULL) goto err;
378.   	/* do the decrypt */
379.   	if ((rsa->_method_mod_n == NULL) && (rsa->flags & RSA_FLAG_CACHE_PUBLIC))
             ^
380.   		{
381.   		if ((rsa->_method_mod_n=BN_MONT_CTX_new()) != NULL)

crypto/rsa/rsa_eay.c:386:7: 
384.   		}
385.   
386. > 	if (!meth->bn_mod_exp(&ret,&f,rsa->e,rsa->n,ctx,
387.   		rsa->_method_mod_n)) goto err;
388.   
