crypto/rsa/rsa_lib.c:139: error: NULL_DEREFERENCE
  pointer `meth` last assigned on line 136 could be null and is dereferenced at line 139, column 6.
Showing all 44 steps of the trace


crypto/rsa/rsa_lib.c:131:1: start of procedure RSA_set_method()
129.   }
130.   #else
131. > int RSA_set_method(RSA *rsa, ENGINE *engine)
132.   {
133.   	ENGINE *mtmp;

crypto/rsa/rsa_lib.c:135:2: 
133.   	ENGINE *mtmp;
134.   	RSA_METHOD *meth;
135. > 	mtmp = rsa->engine;
136.   	meth = ENGINE_get_RSA(mtmp);
137.   	if (!ENGINE_init(engine))

crypto/rsa/rsa_lib.c:136:2: 
134.   	RSA_METHOD *meth;
135.   	mtmp = rsa->engine;
136. > 	meth = ENGINE_get_RSA(mtmp);
137.   	if (!ENGINE_init(engine))
138.   		return 0;

crypto/engine/engine_list.c:581:1: start of procedure ENGINE_get_RSA()
  579.   	}
  580.   
  581. > RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  582.   	{
  583.   	if(e == NULL)

crypto/engine/engine_list.c:583:5: Taking true branch
  581.   RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  582.   	{
  583.   	if(e == NULL)
             ^
  584.   		{
  585.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,

crypto/engine/engine_list.c:585:3: 
  583.   	if(e == NULL)
  584.   		{
  585. > 		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  586.   			ERR_R_PASSED_NULL_PARAMETER);
  587.   		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:587:3: 
  585.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  586.   			ERR_R_PASSED_NULL_PARAMETER);
  587. > 		return NULL;
  588.   		}
  589.   	return e->rsa_meth;

crypto/engine/engine_list.c:590:2: return from a call to ENGINE_get_RSA
  588.   		}
  589.   	return e->rsa_meth;
  590.   	}
          ^
  591.   
  592.   DSA_METHOD *ENGINE_get_DSA(ENGINE *e)

crypto/rsa/rsa_lib.c:137:7: 
135.   	mtmp = rsa->engine;
136.   	meth = ENGINE_get_RSA(mtmp);
137. > 	if (!ENGINE_init(engine))
138.   		return 0;
139.   	if (meth->finish) meth->finish(rsa);

crypto/engine/engine_lib.c:143:1: start of procedure ENGINE_init()
  141.   /* Initialise a engine type for use (or up its functional reference count
  142.    * if it's already in use). */
  143. > int ENGINE_init(ENGINE *e)
  144.   	{
  145.   	int to_return = 1;

crypto/engine/engine_lib.c:145:2: 
  143.   int ENGINE_init(ENGINE *e)
  144.   	{
  145. > 	int to_return = 1;
  146.   
  147.   	if(e == NULL)

crypto/engine/engine_lib.c:147:5: Taking false branch
  145.   	int to_return = 1;
  146.   
  147.   	if(e == NULL)
             ^
  148.   		{
  149.   		ENGINEerr(ENGINE_F_ENGINE_INIT,ERR_R_PASSED_NULL_PARAMETER);

crypto/engine/engine_lib.c:152:2: 
  150.   		return 0;
  151.   		}
  152. > 	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  153.   	if((e->funct_ref == 0) && e->init)
  154.   		/* This is the first functional reference and the engine

crypto/cryptlib.c:372:1: start of procedure CRYPTO_lock()
    370.   	}
    371.   
    372. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    373.   	{
    374.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:397:6: Taking false branch
    395.   		}
    396.   #endif
    397.   	if (type < 0)
                ^
    398.   		{
    399.   		int i = -type - 1;

crypto/cryptlib.c:411:7: Taking true branch
    409.   		}
    410.   	else
    411.   		if (locking_callback != NULL)
                 ^
    412.   			locking_callback(mode,type,file,line);
    413.   	}

crypto/cryptlib.c:412:4: Skipping __function_pointer__(): unresolved function pointer
    410.   	else
    411.   		if (locking_callback != NULL)
    412.   			locking_callback(mode,type,file,line);
              ^
    413.   	}
    414.   

crypto/cryptlib.c:397:2: 
    395.   		}
    396.   #endif
    397. > 	if (type < 0)
    398.   		{
    399.   		int i = -type - 1;

crypto/cryptlib.c:413:2: return from a call to CRYPTO_lock
    411.   		if (locking_callback != NULL)
    412.   			locking_callback(mode,type,file,line);
    413.   	}
            ^
    414.   
    415.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/engine_lib.c:153:6: Taking false branch
  151.   		}
  152.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  153.   	if((e->funct_ref == 0) && e->init)
              ^
  154.   		/* This is the first functional reference and the engine
  155.   		 * requires initialisation so we do it now. */

crypto/engine/engine_lib.c:157:5: Taking true branch
  155.   		 * requires initialisation so we do it now. */
  156.   		to_return = e->init();
  157.   	if(to_return)
             ^
  158.   		{
  159.   		/* OK, we return a functional reference which is also a

crypto/engine/engine_lib.c:161:3: 
  159.   		/* OK, we return a functional reference which is also a
  160.   		 * structural reference. */
  161. > 		e->struct_ref++;
  162.   		e->funct_ref++;
  163.   		}

crypto/engine/engine_lib.c:162:3: 
  160.   		 * structural reference. */
  161.   		e->struct_ref++;
  162. > 		e->funct_ref++;
  163.   		}
  164.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);

crypto/engine/engine_lib.c:164:2: 
  162.   		e->funct_ref++;
  163.   		}
  164. > 	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  165.   	return to_return;
  166.   	}

crypto/cryptlib.c:372:1: start of procedure CRYPTO_lock()
    370.   	}
    371.   
    372. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    373.   	{
    374.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:397:6: Taking false branch
    395.   		}
    396.   #endif
    397.   	if (type < 0)
                ^
    398.   		{
    399.   		int i = -type - 1;

crypto/cryptlib.c:411:7: Taking true branch
    409.   		}
    410.   	else
    411.   		if (locking_callback != NULL)
                 ^
    412.   			locking_callback(mode,type,file,line);
    413.   	}

crypto/cryptlib.c:412:4: Skipping __function_pointer__(): unresolved function pointer
    410.   	else
    411.   		if (locking_callback != NULL)
    412.   			locking_callback(mode,type,file,line);
              ^
    413.   	}
    414.   

crypto/cryptlib.c:397:2: 
    395.   		}
    396.   #endif
    397. > 	if (type < 0)
    398.   		{
    399.   		int i = -type - 1;

crypto/cryptlib.c:413:2: return from a call to CRYPTO_lock
    411.   		if (locking_callback != NULL)
    412.   			locking_callback(mode,type,file,line);
    413.   	}
            ^
    414.   
    415.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/engine_lib.c:165:2: 
  163.   		}
  164.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  165. > 	return to_return;
  166.   	}
  167.   

crypto/engine/engine_lib.c:166:2: return from a call to ENGINE_init
  164.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  165.   	return to_return;
  166.   	}
          ^
  167.   
  168.   /* Free a functional reference to a engine type */

crypto/rsa/rsa_lib.c:137:7: Taking false branch
135.   	mtmp = rsa->engine;
136.   	meth = ENGINE_get_RSA(mtmp);
137.   	if (!ENGINE_init(engine))
             ^
138.   		return 0;
139.   	if (meth->finish) meth->finish(rsa);

crypto/rsa/rsa_lib.c:139:6: Taking false branch
137.   	if (!ENGINE_init(engine))
138.   		return 0;
139.   	if (meth->finish) meth->finish(rsa);
            ^
140.   	rsa->engine = engine;
141.   	meth = ENGINE_get_RSA(engine);

int RSA_set_method(RSA *rsa, ENGINE *engine)
{
	ENGINE *mtmp;
	RSA_METHOD *meth;
	mtmp = rsa->engine;
	meth = ENGINE_get_RSA(mtmp);
	if (!ENGINE_init(engine))
		return 0;
	if (meth->finish) meth->finish(rsa);
	rsa->engine = engine;
	meth = ENGINE_get_RSA(engine);
	if (meth->init) meth->init(rsa);
	ENGINE_finish(mtmp);
	return 1;
}
['int RSA_set_method(RSA *rsa, ENGINE *engine)\n{\n\tENGINE *mtmp;\n\tRSA_METHOD *meth;\n\tmtmp = rsa->engine;\n\tmeth = ENGINE_get_RSA(mtmp);\n\tif (!ENGINE_init(engine))\n\t\treturn 0;\n\tif (meth->finish) meth->finish(rsa);\n\trsa->engine = engine;\n\tmeth = ENGINE_get_RSA(engine);\n\tif (meth->init) meth->init(rsa);\n\tENGINE_finish(mtmp);\n\treturn 1;\n}', 'RSA_METHOD *ENGINE_get_RSA(ENGINE *e)\n\t{\n\tif(e == NULL)\n\t\t{\n\t\tENGINEerr(ENGINE_F_ENGINE_GET_RSA,\n\t\t\tERR_R_PASSED_NULL_PARAMETER);\n\t\treturn NULL;\n\t\t}\n\treturn e->rsa_meth;\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}', 'int ENGINE_init(ENGINE *e)\n\t{\n\tint to_return = 1;\n\tif(e == NULL)\n\t\t{\n\t\tENGINEerr(ENGINE_F_ENGINE_INIT,ERR_R_PASSED_NULL_PARAMETER);\n\t\treturn 0;\n\t\t}\n\tCRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n\tif((e->funct_ref == 0) && e->init)\n\t\tto_return = e->init();\n\tif(to_return)\n\t\t{\n\t\te->struct_ref++;\n\t\te->funct_ref++;\n\t\t}\n\tCRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n\treturn to_return;\n\t}', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_thread_id(), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (type < 0)\n\t\t{\n\t\tint i = -type - 1;\n\t\tstruct CRYPTO_dynlock_value *pointer\n\t\t\t= CRYPTO_get_dynlock_value(i);\n\t\tif (pointer)\n\t\t\t{\n\t\t\tdynlock_lock_callback(mode, pointer, file, line);\n\t\t\t}\n\t\tCRYPTO_destroy_dynlockid(i);\n\t\t}\n\telse\n\t\tif (locking_callback != NULL)\n\t\t\tlocking_callback(mode,type,file,line);\n\t}']