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


crypto/asn1/ameth_lib.c:193:1: start of procedure EVP_PKEY_asn1_find_str()
191.   	}
192.   
193. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
194.   					const char *str, int len)
195.   	{

crypto/asn1/ameth_lib.c:198:6: Taking true branch
196.   	int i;
197.   	const EVP_PKEY_ASN1_METHOD *ameth;
198.   	if (len == -1)
            ^
199.   		len = strlen(str);
200.   	if (pe)

crypto/asn1/ameth_lib.c:199:3: 
197.   	const EVP_PKEY_ASN1_METHOD *ameth;
198.   	if (len == -1)
199. > 		len = strlen(str);
200.   	if (pe)
201.   		{

crypto/asn1/ameth_lib.c:200:6: Taking true branch
198.   	if (len == -1)
199.   		len = strlen(str);
200.   	if (pe)
            ^
201.   		{
202.   #ifndef OPENSSL_NO_ENGINE

crypto/asn1/ameth_lib.c:204:8: 
202.   #ifndef OPENSSL_NO_ENGINE
203.   		ENGINE *e;
204. > 		for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
205.   			{
206.   			ameth = ENGINE_get_pkey_asn1_meth_str(e, str, len);

crypto/engine/eng_list.c:192:1: start of procedure ENGINE_get_first()
  190.   
  191.   /* Get the first/last "ENGINE" type available. */
  192. > ENGINE *ENGINE_get_first(void)
  193.   	{
  194.   	ENGINE *ret;

crypto/engine/eng_list.c:196:2: 
  194.   	ENGINE *ret;
  195.   
  196. > 	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  197.   	ret = engine_list_head;
  198.   	if(ret)

crypto/cryptlib.c:450:1: start of procedure CRYPTO_lock()
    448.   	}
    449.   
    450. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    451.   	{
    452.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:475:6: Taking false branch
    473.   		}
    474.   #endif
    475.   	if (type < 0)
                ^
    476.   		{
    477.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:490:7: Taking true branch
    488.   		}
    489.   	else
    490.   		if (locking_callback != NULL)
                 ^
    491.   			locking_callback(mode,type,file,line);
    492.   	}

crypto/cryptlib.c:491:4: Skipping __function_pointer__(): unresolved function pointer
    489.   	else
    490.   		if (locking_callback != NULL)
    491.   			locking_callback(mode,type,file,line);
              ^
    492.   	}
    493.   

crypto/cryptlib.c:475:2: 
    473.   		}
    474.   #endif
    475. > 	if (type < 0)
    476.   		{
    477.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:492:2: return from a call to CRYPTO_lock
    490.   		if (locking_callback != NULL)
    491.   			locking_callback(mode,type,file,line);
    492.   	}
            ^
    493.   
    494.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/eng_list.c:197:2: 
  195.   
  196.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  197. > 	ret = engine_list_head;
  198.   	if(ret)
  199.   		{

crypto/engine/eng_list.c:198:5: Taking false branch
  196.   	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
  197.   	ret = engine_list_head;
  198.   	if(ret)
             ^
  199.   		{
  200.   		ret->struct_ref++;

crypto/engine/eng_list.c:203:2: 
  201.   		engine_ref_debug(ret, 0, 1)
  202.   		}
  203. > 	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  204.   	return ret;
  205.   	}

crypto/cryptlib.c:450:1: start of procedure CRYPTO_lock()
    448.   	}
    449.   
    450. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    451.   	{
    452.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:475:6: Taking false branch
    473.   		}
    474.   #endif
    475.   	if (type < 0)
                ^
    476.   		{
    477.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:490:7: Taking true branch
    488.   		}
    489.   	else
    490.   		if (locking_callback != NULL)
                 ^
    491.   			locking_callback(mode,type,file,line);
    492.   	}

crypto/cryptlib.c:491:4: Skipping __function_pointer__(): unresolved function pointer
    489.   	else
    490.   		if (locking_callback != NULL)
    491.   			locking_callback(mode,type,file,line);
              ^
    492.   	}
    493.   

crypto/cryptlib.c:475:2: 
    473.   		}
    474.   #endif
    475. > 	if (type < 0)
    476.   		{
    477.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:492:2: return from a call to CRYPTO_lock
    490.   		if (locking_callback != NULL)
    491.   			locking_callback(mode,type,file,line);
    492.   	}
            ^
    493.   
    494.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/eng_list.c:204:2: 
  202.   		}
  203.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  204. > 	return ret;
  205.   	}
  206.   

crypto/engine/eng_list.c:205:2: return from a call to ENGINE_get_first
  203.   	CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
  204.   	return ret;
  205.   	}
          ^
  206.   
  207.   ENGINE *ENGINE_get_last(void)

crypto/asn1/ameth_lib.c:204:32: Loop condition is false. Leaving loop
202.   #ifndef OPENSSL_NO_ENGINE
203.   		ENGINE *e;
204.   		for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
                                      ^
205.   			{
206.   			ameth = ENGINE_get_pkey_asn1_meth_str(e, str, len);

crypto/asn1/ameth_lib.c:220:3: 
218.   			}
219.   #endif
220. > 		*pe = NULL;
221.   		}
222.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)

crypto/asn1/ameth_lib.c:222:7: 
220.   		*pe = NULL;
221.   		}
222. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
223.   		{
224.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:222:14: 
220.   		*pe = NULL;
221.   		}
222. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
223.   		{
224.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:118:1: start of procedure EVP_PKEY_asn1_get_count()
  116.   	}
  117.   
  118. > int EVP_PKEY_asn1_get_count(void)
  119.   	{
  120.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:120:2: 
  118.   int EVP_PKEY_asn1_get_count(void)
  119.   	{
  120. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  121.   	if (app_methods)
  122.   		num += sk_num(app_methods);

crypto/asn1/ameth_lib.c:121:6: Taking false branch
  119.   	{
  120.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  121.   	if (app_methods)
              ^
  122.   		num += sk_num(app_methods);
  123.   	return num;

crypto/asn1/ameth_lib.c:123:2: 
  121.   	if (app_methods)
  122.   		num += sk_num(app_methods);
  123. > 	return num;
  124.   	}
  125.   

crypto/asn1/ameth_lib.c:124:2: return from a call to EVP_PKEY_asn1_get_count
  122.   		num += sk_num(app_methods);
  123.   	return num;
  124.   	}
          ^
  125.   
  126.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)

crypto/asn1/ameth_lib.c:222:14: Loop condition is true. Entering loop body
220.   		*pe = NULL;
221.   		}
222.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
                    ^
223.   		{
224.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:224:3: 
222.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
223.   		{
224. > 		ameth = EVP_PKEY_asn1_get0(i);
225.   		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
226.   			continue;

crypto/asn1/ameth_lib.c:126:1: start of procedure EVP_PKEY_asn1_get0()
  124.   	}
  125.   
  126. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  127.   	{
  128.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:128:2: 
  126.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  127.   	{
  128. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  129.   	if (idx < 0)
  130.   		return NULL; 

crypto/asn1/ameth_lib.c:129:6: Taking false branch
  127.   	{
  128.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  129.   	if (idx < 0)
              ^
  130.   		return NULL; 
  131.   	if (idx < num)

crypto/asn1/ameth_lib.c:131:6: Taking false branch
  129.   	if (idx < 0)
  130.   		return NULL; 
  131.   	if (idx < num)
              ^
  132.   		return standard_methods[idx];
  133.   	idx -= num;

crypto/asn1/ameth_lib.c:133:2: 
  131.   	if (idx < num)
  132.   		return standard_methods[idx];
  133. > 	idx -= num;
  134.   	return (const EVP_PKEY_ASN1_METHOD *)sk_value(app_methods, idx);
  135.   	}

crypto/asn1/ameth_lib.c:134:2: 
  132.   		return standard_methods[idx];
  133.   	idx -= num;
  134. > 	return (const EVP_PKEY_ASN1_METHOD *)sk_value(app_methods, idx);
  135.   	}
  136.   

crypto/stack/stack.c:307:1: start of procedure sk_value()
    305.   }
    306.   
    307. > char *sk_value(const STACK *st, int i)
    308.   {
    309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:309:6: Taking true branch
    307.   char *sk_value(const STACK *st, int i)
    308.   {
    309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                ^
    310.   	return st->data[i];
    311.   }

crypto/stack/stack.c:309:39: 
    307.   char *sk_value(const STACK *st, int i)
    308.   {
    309. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
    310.   	return st->data[i];
    311.   }

crypto/stack/stack.c:311:1: return from a call to sk_value
    309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    310.   	return st->data[i];
    311. > }
    312.   
    313.   char *sk_set(STACK *st, int i, char *value)

crypto/asn1/ameth_lib.c:135:2: return from a call to EVP_PKEY_asn1_get0
  133.   	idx -= num;
  134.   	return (const EVP_PKEY_ASN1_METHOD *)sk_value(app_methods, idx);
  135.   	}
          ^
  136.   
  137.   static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)

crypto/asn1/ameth_lib.c:225:7: 
223.   		{
224.   		ameth = EVP_PKEY_asn1_get0(i);
225. > 		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
226.   			continue;
227.   		if (((int)strlen(ameth->pem_str) == len) && 
