crypto/asn1/ameth_lib.c:235: error: NULL_DEREFERENCE
  pointer `ameth` last assigned on line 234 could be null and is dereferenced at line 235, column 7.
Showing all 59 steps of the trace


crypto/asn1/ameth_lib.c:206:1: start of procedure EVP_PKEY_asn1_find_str()
204.   	}
205.   
206. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
207.   					const char *str, int len)
208.   	{

crypto/asn1/ameth_lib.c:211:6: Taking true branch
209.   	int i;
210.   	const EVP_PKEY_ASN1_METHOD *ameth;
211.   	if (len == -1)
            ^
212.   		len = strlen(str);
213.   	if (pe)

crypto/asn1/ameth_lib.c:212:3: 
210.   	const EVP_PKEY_ASN1_METHOD *ameth;
211.   	if (len == -1)
212. > 		len = strlen(str);
213.   	if (pe)
214.   		{

crypto/asn1/ameth_lib.c:213:6: Taking true branch
211.   	if (len == -1)
212.   		len = strlen(str);
213.   	if (pe)
            ^
214.   		{
215.   #ifndef OPENSSL_NO_ENGINE

crypto/asn1/ameth_lib.c:217:3: 
215.   #ifndef OPENSSL_NO_ENGINE
216.   		ENGINE *e;
217. > 		ameth = ENGINE_pkey_asn1_find_str(&e, str, len);
218.   		if (ameth)
219.   			{

crypto/engine/tb_asnmth.c:227:1: start of procedure ENGINE_pkey_asn1_find_str()
  225.   	}
  226.   
  227. > const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
  228.   					const char *str, int len)
  229.   	{

crypto/engine/tb_asnmth.c:231:2: 
  229.   	{
  230.   	ENGINE_FIND_STR fstr;
  231. > 	fstr.e = NULL;
  232.   	fstr.ameth = NULL;
  233.   	fstr.str = str;

crypto/engine/tb_asnmth.c:232:2: 
  230.   	ENGINE_FIND_STR fstr;
  231.   	fstr.e = NULL;
  232. > 	fstr.ameth = NULL;
  233.   	fstr.str = str;
  234.   	fstr.len = len;

crypto/engine/tb_asnmth.c:233:2: 
  231.   	fstr.e = NULL;
  232.   	fstr.ameth = NULL;
  233. > 	fstr.str = str;
  234.   	fstr.len = len;
  235.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);

crypto/engine/tb_asnmth.c:234:2: 
  232.   	fstr.ameth = NULL;
  233.   	fstr.str = str;
  234. > 	fstr.len = len;
  235.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  236.   	engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);

crypto/engine/tb_asnmth.c:235:2: 
  233.   	fstr.str = str;
  234.   	fstr.len = len;
  235. > 	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  236.   	engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
  237.   	/* If found obtain a structural reference to engine */

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
    424.   	}
    425.   
    426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    427.   	{
    428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
    451.   		}
    452.   #endif
    453.   	if (type < 0)
                ^
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
    466.   		}
    467.   	else
    468.   		if (locking_callback != NULL)
                 ^
    469.   			locking_callback(mode,type,file,line);
    470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
    467.   	else
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
              ^
    470.   	}
    471.   

crypto/lock.c:453:2: 
    451.   		}
    452.   #endif
    453. > 	if (type < 0)
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
    470.   	}
            ^
    471.   
    472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/tb_asnmth.c:236:2: 
  234.   	fstr.len = len;
  235.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  236. > 	engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
  237.   	/* If found obtain a structural reference to engine */
  238.   	if (fstr.e)

crypto/engine/eng_table.c:343:1: start of procedure engine_table_doall()
    341.   static IMPLEMENT_LHASH_DOALL_ARG_FN(int_cb, ENGINE_PILE,ENGINE_PILE_DOALL)
    342.   
    343. > void engine_table_doall(ENGINE_TABLE *table, engine_table_doall_cb *cb,
    344.   								void *arg)
    345.   	{

crypto/engine/eng_table.c:347:2: 
    345.   	{
    346.   	ENGINE_PILE_DOALL dall;
    347. > 	dall.cb = cb;
    348.   	dall.arg = arg;
    349.   	if (table)

crypto/engine/eng_table.c:348:2: 
    346.   	ENGINE_PILE_DOALL dall;
    347.   	dall.cb = cb;
    348. > 	dall.arg = arg;
    349.   	if (table)
    350.   		lh_ENGINE_PILE_doall_arg(&table->piles,

crypto/engine/eng_table.c:349:6: Taking false branch
    347.   	dall.cb = cb;
    348.   	dall.arg = arg;
    349.   	if (table)
                ^
    350.   		lh_ENGINE_PILE_doall_arg(&table->piles,
    351.   				LHASH_DOALL_ARG_FN(int_cb),

crypto/engine/eng_table.c:349:2: 
    347.   	dall.cb = cb;
    348.   	dall.arg = arg;
    349. > 	if (table)
    350.   		lh_ENGINE_PILE_doall_arg(&table->piles,
    351.   				LHASH_DOALL_ARG_FN(int_cb),

crypto/engine/eng_table.c:353:2: return from a call to engine_table_doall
    351.   				LHASH_DOALL_ARG_FN(int_cb),
    352.   				ENGINE_PILE_DOALL, &dall);
    353.   	}
            ^

crypto/engine/tb_asnmth.c:238:6: Taking false branch
  236.   	engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr);
  237.   	/* If found obtain a structural reference to engine */
  238.   	if (fstr.e)
              ^
  239.   		{
  240.   		fstr.e->struct_ref++;

crypto/engine/tb_asnmth.c:243:2: 
  241.   		engine_ref_debug(fstr.e, 0, 1)
  242.   		}
  243. > 	*pe = fstr.e;
  244.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  245.   	return fstr.ameth;

crypto/engine/tb_asnmth.c:244:2: 
  242.   		}
  243.   	*pe = fstr.e;
  244. > 	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  245.   	return fstr.ameth;
  246.   	}

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
    424.   	}
    425.   
    426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    427.   	{
    428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
    451.   		}
    452.   #endif
    453.   	if (type < 0)
                ^
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
    466.   		}
    467.   	else
    468.   		if (locking_callback != NULL)
                 ^
    469.   			locking_callback(mode,type,file,line);
    470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
    467.   	else
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
              ^
    470.   	}
    471.   

crypto/lock.c:453:2: 
    451.   		}
    452.   #endif
    453. > 	if (type < 0)
    454.   		{
    455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
    468.   		if (locking_callback != NULL)
    469.   			locking_callback(mode,type,file,line);
    470.   	}
            ^
    471.   
    472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/tb_asnmth.c:245:2: 
  243.   	*pe = fstr.e;
  244.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  245. > 	return fstr.ameth;
  246.   	}

crypto/engine/tb_asnmth.c:246:2: return from a call to ENGINE_pkey_asn1_find_str
  244.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  245.   	return fstr.ameth;
  246.   	}
          ^

crypto/asn1/ameth_lib.c:218:7: Taking false branch
216.   		ENGINE *e;
217.   		ameth = ENGINE_pkey_asn1_find_str(&e, str, len);
218.   		if (ameth)
             ^
219.   			{
220.   			/* Convert structural into

crypto/asn1/ameth_lib.c:230:3: 
228.   			}
229.   #endif
230. > 		*pe = NULL;
231.   		}
232.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)

crypto/asn1/ameth_lib.c:232:7: 
230.   		*pe = NULL;
231.   		}
232. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
233.   		{
234.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:232:14: 
230.   		*pe = NULL;
231.   		}
232. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
233.   		{
234.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:133:1: start of procedure EVP_PKEY_asn1_get_count()
  131.   			     const EVP_PKEY_ASN1_METHOD *, ameth);
  132.   
  133. > int EVP_PKEY_asn1_get_count(void)
  134.   	{
  135.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:135:2: 
  133.   int EVP_PKEY_asn1_get_count(void)
  134.   	{
  135. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  136.   	if (app_methods)
  137.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);

crypto/asn1/ameth_lib.c:136:6: Taking false branch
  134.   	{
  135.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  136.   	if (app_methods)
              ^
  137.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  138.   	return num;

crypto/asn1/ameth_lib.c:138:2: 
  136.   	if (app_methods)
  137.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  138. > 	return num;
  139.   	}
  140.   

crypto/asn1/ameth_lib.c:139:2: return from a call to EVP_PKEY_asn1_get_count
  137.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  138.   	return num;
  139.   	}
          ^
  140.   
  141.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)

crypto/asn1/ameth_lib.c:232:14: Loop condition is true. Entering loop body
230.   		*pe = NULL;
231.   		}
232.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
                    ^
233.   		{
234.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:234:3: 
232.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
233.   		{
234. > 		ameth = EVP_PKEY_asn1_get0(i);
235.   		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
236.   			continue;

crypto/asn1/ameth_lib.c:141:1: start of procedure EVP_PKEY_asn1_get0()
  139.   	}
  140.   
  141. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  142.   	{
  143.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:143:2: 
  141.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  142.   	{
  143. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  144.   	if (idx < 0)
  145.   		return NULL; 

crypto/asn1/ameth_lib.c:144:6: Taking false branch
  142.   	{
  143.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  144.   	if (idx < 0)
              ^
  145.   		return NULL; 
  146.   	if (idx < num)

crypto/asn1/ameth_lib.c:146:6: Taking false branch
  144.   	if (idx < 0)
  145.   		return NULL; 
  146.   	if (idx < num)
              ^
  147.   		return standard_methods[idx];
  148.   	idx -= num;

crypto/asn1/ameth_lib.c:148:2: 
  146.   	if (idx < num)
  147.   		return standard_methods[idx];
  148. > 	idx -= num;
  149.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  150.   	}

crypto/asn1/ameth_lib.c:149:9: Condition is true
  147.   		return standard_methods[idx];
  148.   	idx -= num;
  149.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
                 ^
  150.   	}
  151.   

crypto/asn1/ameth_lib.c:149:2: 
  147.   		return standard_methods[idx];
  148.   	idx -= num;
  149. > 	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  150.   	}
  151.   

crypto/stack/stack.c:337:1: start of procedure sk_value()
    335.   }
    336.   
    337. > void *sk_value(const _STACK *st, int i)
    338.   {
    339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:339:6: Taking true branch
    337.   void *sk_value(const _STACK *st, int i)
    338.   {
    339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                ^
    340.   	return st->data[i];
    341.   }

crypto/stack/stack.c:339:39: 
    337.   void *sk_value(const _STACK *st, int i)
    338.   {
    339. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
    340.   	return st->data[i];
    341.   }

crypto/stack/stack.c:341:1: return from a call to sk_value
    339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    340.   	return st->data[i];
    341. > }
    342.   
    343.   void *sk_set(_STACK *st, int i, void *value)

crypto/asn1/ameth_lib.c:150:2: return from a call to EVP_PKEY_asn1_get0
  148.   	idx -= num;
  149.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  150.   	}
          ^
  151.   
  152.   static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)

crypto/asn1/ameth_lib.c:235:7: 
233.   		{
234.   		ameth = EVP_PKEY_asn1_get0(i);
235. > 		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
236.   			continue;
237.   		if (((int)strlen(ameth->pem_str) == len) && 
