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


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

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

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

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

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

crypto/asn1/ameth_lib.c:228:14: 
226.   		*pe = NULL;
227.   		}
228. > 	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
229.   		{
230.   		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_cmp);
  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:228:14: Loop condition is true. Entering loop body
226.   		*pe = NULL;
227.   		}
228.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
                    ^
229.   		{
230.   		ameth = EVP_PKEY_asn1_get0(i);

crypto/asn1/ameth_lib.c:230:3: 
228.   	for (i = 0; i < EVP_PKEY_asn1_get_count(); i++)
229.   		{
230. > 		ameth = EVP_PKEY_asn1_get0(i);
231.   		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
232.   			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:308:1: start of procedure sk_value()
    306.   }
    307.   
    308. > void *sk_value(const _STACK *st, int i)
    309.   {
    310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

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

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

crypto/stack/stack.c:312:1: return from a call to sk_value
    310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    311.   	return st->data[i];
    312. > }
    313.   
    314.   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:231:7: 
229.   		{
230.   		ameth = EVP_PKEY_asn1_get0(i);
231. > 		if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
232.   			continue;
233.   		if (((int)strlen(ameth->pem_str) == len) && 
