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


crypto/asn1/ameth_lib.c:159:1: start of procedure EVP_PKEY_asn1_find_str()
157.   	}
158.   
159. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(const char *str, int len)
160.   	{
161.   	int i;

crypto/asn1/ameth_lib.c:163:6: Taking true branch
161.   	int i;
162.   	const EVP_PKEY_ASN1_METHOD *ameth;
163.   	if (len == -1)
            ^
164.   		len = strlen(str);
165.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)

crypto/asn1/ameth_lib.c:164:3: 
162.   	const EVP_PKEY_ASN1_METHOD *ameth;
163.   	if (len == -1)
164. > 		len = strlen(str);
165.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
166.   		{

crypto/asn1/ameth_lib.c:165:7: 
163.   	if (len == -1)
164.   		len = strlen(str);
165. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
166.   		{
167.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:165:14: 
163.   	if (len == -1)
164.   		len = strlen(str);
165. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
166.   		{
167.   		ameth = EVP_PKEY_asn1_get0(i);

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

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

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

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

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

crypto/asn1/ameth_lib.c:165:14: Loop condition is true. Entering loop body
163.   	if (len == -1)
164.   		len = strlen(str);
165.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
                    ^
166.   		{
167.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:167:3: 
165.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
166.   		{
167. > 		ameth = EVP_PKEY_asn1_get0(i);
168.   		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
169.   			continue;

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

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

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

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

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

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

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:133:2: return from a call to EVP_PKEY_asn1_get0
  131.   	idx -= num;
  132.   	return (const EVP_PKEY_ASN1_METHOD *)sk_value(app_methods, idx);
  133.   	}
          ^
  134.   
  135.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(int type)

crypto/asn1/ameth_lib.c:168:7: 
166.   		{
167.   		ameth = EVP_PKEY_asn1_get0(i);
168. > 		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
169.   			continue;
170.   		if (((int)strlen(ameth->pem_str) == len) && 
