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


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

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

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

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

crypto/asn1/ameth_lib.c:206:8: 
204.   #ifndef OPENSSL_NO_ENGINE
205.   		ENGINE *e;
206. > 		for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
207.   			{
208.   			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:473:1: start of procedure CRYPTO_lock()
    471.   	}
    472.   
    473. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    474.   	{
    475.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:498:6: Taking false branch
    496.   		}
    497.   #endif
    498.   	if (type < 0)
                ^
    499.   		{
    500.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:513:7: Taking true branch
    511.   		}
    512.   	else
    513.   		if (locking_callback != NULL)
                 ^
    514.   			locking_callback(mode,type,file,line);
    515.   	}

crypto/cryptlib.c:514:4: Skipping __function_pointer__(): unresolved function pointer
    512.   	else
    513.   		if (locking_callback != NULL)
    514.   			locking_callback(mode,type,file,line);
              ^
    515.   	}
    516.   

crypto/cryptlib.c:498:2: 
    496.   		}
    497.   #endif
    498. > 	if (type < 0)
    499.   		{
    500.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:515:2: return from a call to CRYPTO_lock
    513.   		if (locking_callback != NULL)
    514.   			locking_callback(mode,type,file,line);
    515.   	}
            ^
    516.   
    517.   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:473:1: start of procedure CRYPTO_lock()
    471.   	}
    472.   
    473. > void CRYPTO_lock(int mode, int type, const char *file, int line)
    474.   	{
    475.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:498:6: Taking false branch
    496.   		}
    497.   #endif
    498.   	if (type < 0)
                ^
    499.   		{
    500.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:513:7: Taking true branch
    511.   		}
    512.   	else
    513.   		if (locking_callback != NULL)
                 ^
    514.   			locking_callback(mode,type,file,line);
    515.   	}

crypto/cryptlib.c:514:4: Skipping __function_pointer__(): unresolved function pointer
    512.   	else
    513.   		if (locking_callback != NULL)
    514.   			locking_callback(mode,type,file,line);
              ^
    515.   	}
    516.   

crypto/cryptlib.c:498:2: 
    496.   		}
    497.   #endif
    498. > 	if (type < 0)
    499.   		{
    500.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:515:2: return from a call to CRYPTO_lock
    513.   		if (locking_callback != NULL)
    514.   			locking_callback(mode,type,file,line);
    515.   	}
            ^
    516.   
    517.   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:206:32: Loop condition is false. Leaving loop
204.   #ifndef OPENSSL_NO_ENGINE
205.   		ENGINE *e;
206.   		for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
                                      ^
207.   			{
208.   			ameth = ENGINE_get_pkey_asn1_meth_str(e, str, len);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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:137:2: return from a call to EVP_PKEY_asn1_get0
  135.   	idx -= num;
  136.   	return (const EVP_PKEY_ASN1_METHOD *)sk_value(app_methods, idx);
  137.   	}
          ^
  138.   
  139.   static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)

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