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


crypto/asn1/ameth_lib.c:200:1: start of procedure EVP_PKEY_asn1_find_str()
198.   	}
199.   
200. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
201.   					const char *str, int len)
202.   	{

crypto/asn1/ameth_lib.c:205:6: Taking true branch
203.   	int i;
204.   	const EVP_PKEY_ASN1_METHOD *ameth;
205.   	if (len == -1)
            ^
206.   		len = strlen(str);
207.   	if (pe)

crypto/asn1/ameth_lib.c:206:3: 
204.   	const EVP_PKEY_ASN1_METHOD *ameth;
205.   	if (len == -1)
206. > 		len = strlen(str);
207.   	if (pe)
208.   		{

crypto/asn1/ameth_lib.c:207:6: Taking false branch
205.   	if (len == -1)
206.   		len = strlen(str);
207.   	if (pe)
            ^
208.   		{
209.   #ifndef OPENSSL_NO_ENGINE

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

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

crypto/asn1/ameth_lib.c:127:1: start of procedure EVP_PKEY_asn1_get_count()
  125.   			     const EVP_PKEY_ASN1_METHOD *, ameth);
  126.   
  127. > int EVP_PKEY_asn1_get_count(void)
  128.   	{
  129.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:129:2: 
  127.   int EVP_PKEY_asn1_get_count(void)
  128.   	{
  129. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  130.   	if (app_methods)
  131.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);

crypto/asn1/ameth_lib.c:130:6: Taking false branch
  128.   	{
  129.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  130.   	if (app_methods)
              ^
  131.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  132.   	return num;

crypto/asn1/ameth_lib.c:132:2: 
  130.   	if (app_methods)
  131.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  132. > 	return num;
  133.   	}
  134.   

crypto/asn1/ameth_lib.c:133:2: return from a call to EVP_PKEY_asn1_get_count
  131.   		num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods);
  132.   	return num;
  133.   	}
          ^
  134.   
  135.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)

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

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

crypto/asn1/ameth_lib.c:135:1: start of procedure EVP_PKEY_asn1_get0()
  133.   	}
  134.   
  135. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  136.   	{
  137.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);

crypto/asn1/ameth_lib.c:137:2: 
  135.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx)
  136.   	{
  137. > 	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  138.   	if (idx < 0)
  139.   		return NULL; 

crypto/asn1/ameth_lib.c:138:6: Taking false branch
  136.   	{
  137.   	int num = sizeof(standard_methods)/sizeof(EVP_PKEY_ASN1_METHOD *);
  138.   	if (idx < 0)
              ^
  139.   		return NULL; 
  140.   	if (idx < num)

crypto/asn1/ameth_lib.c:140:6: Taking false branch
  138.   	if (idx < 0)
  139.   		return NULL; 
  140.   	if (idx < num)
              ^
  141.   		return standard_methods[idx];
  142.   	idx -= num;

crypto/asn1/ameth_lib.c:142:2: 
  140.   	if (idx < num)
  141.   		return standard_methods[idx];
  142. > 	idx -= num;
  143.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  144.   	}

crypto/asn1/ameth_lib.c:143:9: Condition is true
  141.   		return standard_methods[idx];
  142.   	idx -= num;
  143.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
                 ^
  144.   	}
  145.   

crypto/asn1/ameth_lib.c:143:2: 
  141.   		return standard_methods[idx];
  142.   	idx -= num;
  143. > 	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  144.   	}
  145.   

crypto/stack/stack.c:300:1: start of procedure sk_value()
    298.   }
    299.   
    300. > void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking true branch
    300.   void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                ^
    303.   	return st->data[i];
    304.   }

crypto/stack/stack.c:302:39: 
    300.   void *sk_value(const _STACK *st, int i)
    301.   {
    302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
    303.   	return st->data[i];
    304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    303.   	return st->data[i];
    304. > }
    305.   
    306.   void *sk_set(_STACK *st, int i, void *value)

crypto/asn1/ameth_lib.c:144:2: return from a call to EVP_PKEY_asn1_get0
  142.   	idx -= num;
  143.   	return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
  144.   	}
          ^
  145.   
  146.   static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)

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