crypto/x509/x509_att.c:206: error: NULL_DEREFERENCE
  pointer `at` last assigned on line 205 could be null and is dereferenced by call to `X509_ATTRIBUTE_count()` at line 206, column 24.
Showing all 14 steps of the trace


crypto/x509/x509_att.c:195:1: start of procedure X509at_get0_data_by_OBJ()
193.   }
194.   
195. > void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,
196.   				ASN1_OBJECT *obj, int lastpos, int type)
197.   {

crypto/x509/x509_att.c:200:2: Skipping X509at_get_attr_by_OBJ(): empty list of specs
198.   	int i;
199.   	X509_ATTRIBUTE *at;
200.   	i = X509at_get_attr_by_OBJ(x, obj, lastpos);
        ^
201.   	if (i == -1)
202.   		return NULL;

crypto/x509/x509_att.c:201:6: Taking false branch
199.   	X509_ATTRIBUTE *at;
200.   	i = X509at_get_attr_by_OBJ(x, obj, lastpos);
201.   	if (i == -1)
            ^
202.   		return NULL;
203.   	if ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))

crypto/x509/x509_att.c:203:7: Taking true branch
201.   	if (i == -1)
202.   		return NULL;
203.   	if ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))
             ^
204.   		return NULL;
205.   	at = X509at_get_attr(x, i);

crypto/x509/x509_att.c:203:26: Taking false branch
201.   	if (i == -1)
202.   		return NULL;
203.   	if ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))
                                ^
204.   		return NULL;
205.   	at = X509at_get_attr(x, i);

crypto/x509/x509_att.c:205:2: 
203.   	if ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))
204.   		return NULL;
205. > 	at = X509at_get_attr(x, i);
206.   	if (lastpos <= -3 && (X509_ATTRIBUTE_count(at) != 1))
207.   		return NULL;

crypto/x509/x509_att.c:103:1: start of procedure X509at_get_attr()
  101.   }
  102.   
  103. > X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc)
  104.   {
  105.   	if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0)

crypto/x509/x509_att.c:105:6: Taking true branch
  103.   X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc)
  104.   {
  105.   	if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0)
              ^
  106.   		return NULL;
  107.   	else

crypto/x509/x509_att.c:106:3: 
  104.   {
  105.   	if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0)
  106. > 		return NULL;
  107.   	else
  108.   		return sk_X509_ATTRIBUTE_value(x,loc);

crypto/x509/x509_att.c:109:1: return from a call to X509at_get_attr
  107.   	else
  108.   		return sk_X509_ATTRIBUTE_value(x,loc);
  109. > }
  110.   
  111.   X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc)

crypto/x509/x509_att.c:206:6: Taking true branch
204.   		return NULL;
205.   	at = X509at_get_attr(x, i);
206.   	if (lastpos <= -3 && (X509_ATTRIBUTE_count(at) != 1))
            ^
207.   		return NULL;
208.   	return X509_ATTRIBUTE_get0_data(at, 0, type, NULL);

crypto/x509/x509_att.c:206:24: 
204.   		return NULL;
205.   	at = X509at_get_attr(x, i);
206. > 	if (lastpos <= -3 && (X509_ATTRIBUTE_count(at) != 1))
207.   		return NULL;
208.   	return X509_ATTRIBUTE_get0_data(at, 0, type, NULL);

crypto/x509/x509_att.c:321:1: start of procedure X509_ATTRIBUTE_count()
  319.   }
  320.   
  321. > int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr)
  322.   {
  323.   	if(!attr->single) return sk_ASN1_TYPE_num(attr->value.set);

crypto/x509/x509_att.c:323:6: Taking true branch
  321.   int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr)
  322.   {
  323.   	if(!attr->single) return sk_ASN1_TYPE_num(attr->value.set);
              ^
  324.   	if(attr->value.single) return 1;
  325.   	return 0;

void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,
				ASN1_OBJECT *obj, int lastpos, int type)
{
	int i;
	X509_ATTRIBUTE *at;
	i = X509at_get_attr_by_OBJ(x, obj, lastpos);
	if (i == -1)
		return NULL;
	if ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))
		return NULL;
	at = X509at_get_attr(x, i);
	if (lastpos <= -3 && (X509_ATTRIBUTE_count(at) != 1))
		return NULL;
	return X509_ATTRIBUTE_get0_data(at, 0, type, NULL);
}
['void *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,\n\t\t\t\tASN1_OBJECT *obj, int lastpos, int type)\n{\n\tint i;\n\tX509_ATTRIBUTE *at;\n\ti = X509at_get_attr_by_OBJ(x, obj, lastpos);\n\tif (i == -1)\n\t\treturn NULL;\n\tif ((lastpos <= -2) && (X509at_get_attr_by_OBJ(x, obj, i) != -1))\n\t\treturn NULL;\n\tat = X509at_get_attr(x, i);\n\tif (lastpos <= -3 && (X509_ATTRIBUTE_count(at) != 1))\n\t\treturn NULL;\n\treturn X509_ATTRIBUTE_get0_data(at, 0, type, NULL);\n}', 'X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc)\n{\n\tif (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0)\n\t\treturn NULL;\n\telse\n\t\treturn sk_X509_ATTRIBUTE_value(x,loc);\n}', 'int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr)\n{\n\tif(!attr->single) return sk_ASN1_TYPE_num(attr->value.set);\n\tif(attr->value.single) return 1;\n\treturn 0;\n}']