crypto/asn1/ameth_lib.c:224: error: NULL_DEREFERENCE
  pointer `ameth` last assigned on line 223 could be null and is dereferenced at line 224, column 7.
Showing all 25 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 false branch
200.   	if (len == -1)
201.   		len = strlen(str);
202.   	if (pe)
            ^
203.   		{
204.   #ifndef OPENSSL_NO_ENGINE

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

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

crypto/asn1/ameth_lib.c:223:3: 
221.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
222.   		{
223. > 		ameth = EVP_PKEY_asn1_get0(i);
224.   		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
225.   			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:224:7: 
222.   		{
223.   		ameth = EVP_PKEY_asn1_get0(i);
224. > 		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
225.   			continue;
226.   		if (((int)strlen(ameth->pem_str) == len) && 
