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


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

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

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

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

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

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

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

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

crypto/x509/x509_att.c:106:19: 
  104.   X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc)
  105.   {
  106. > 	if (x == NULL || sk_X509_ATTRIBUTE_num(x) <= loc || loc < 0)
  107.   		return NULL;
  108.   	else

crypto/stack/stack.c:301:1: start of procedure sk_num()
    299.   	}
    300.   
    301. > int sk_num(const STACK *st)
    302.   {
    303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking false branch
    301.   int sk_num(const STACK *st)
    302.   {
    303.   	if(st == NULL) return -1;
               ^
    304.   	return st->num;
    305.   }

crypto/stack/stack.c:304:2: 
    302.   {
    303.   	if(st == NULL) return -1;
    304. > 	return st->num;
    305.   }
    306.   

crypto/stack/stack.c:305:1: return from a call to sk_num
    303.   	if(st == NULL) return -1;
    304.   	return st->num;
    305. > }
    306.   
    307.   char *sk_value(const STACK *st, int i)

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

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

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

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

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

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

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

crypto/x509/x509_att.c:324:6: Taking true branch
  322.   int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr)
  323.   {
  324.   	if(!attr->single) return sk_ASN1_TYPE_num(attr->value.set);
              ^
  325.   	if(attr->value.single) return 1;
  326.   	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 sk_num(const STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\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}']