crypto/x509/x509_trs.c:119: error: NULL_DEREFERENCE
  pointer `pt` last assigned on line 118 could be null and is dereferenced at line 119, column 9.
Showing all 30 steps of the trace


crypto/x509/x509_trs.c:111:1: start of procedure X509_check_trust()
109.   
110.   
111. > int X509_check_trust(X509 *x, int id, int flags)
112.   {
113.   	X509_TRUST *pt;

crypto/x509/x509_trs.c:115:5: Taking false branch
113.   	X509_TRUST *pt;
114.   	int idx;
115.   	if(id == -1) return 1;
           ^
116.   	idx = X509_TRUST_get_by_id(id);
117.   	if(idx == -1) return default_trust(id, x, flags);

crypto/x509/x509_trs.c:116:2: 
114.   	int idx;
115.   	if(id == -1) return 1;
116. > 	idx = X509_TRUST_get_by_id(id);
117.   	if(idx == -1) return default_trust(id, x, flags);
118.   	pt = X509_TRUST_get0(idx);

crypto/x509/x509_trs.c:135:1: start of procedure X509_TRUST_get_by_id()
  133.   }
  134.   
  135. > int X509_TRUST_get_by_id(int id)
  136.   {
  137.   	X509_TRUST tmp;

crypto/x509/x509_trs.c:139:6: Taking true branch
  137.   	X509_TRUST tmp;
  138.   	int idx;
  139.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
              ^
  140.   				 return id - X509_TRUST_MIN;
  141.   	tmp.trust = id;

crypto/x509/x509_trs.c:139:32: Taking false branch
  137.   	X509_TRUST tmp;
  138.   	int idx;
  139.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                                        ^
  140.   				 return id - X509_TRUST_MIN;
  141.   	tmp.trust = id;

crypto/x509/x509_trs.c:141:2: 
  139.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
  140.   				 return id - X509_TRUST_MIN;
  141. > 	tmp.trust = id;
  142.   	if(!trtable) return -1;
  143.   	idx = sk_X509_TRUST_find(trtable, &tmp);

crypto/x509/x509_trs.c:142:6: Taking false branch
  140.   				 return id - X509_TRUST_MIN;
  141.   	tmp.trust = id;
  142.   	if(!trtable) return -1;
              ^
  143.   	idx = sk_X509_TRUST_find(trtable, &tmp);
  144.   	if(idx == -1) return -1;

crypto/x509/x509_trs.c:143:2: 
  141.   	tmp.trust = id;
  142.   	if(!trtable) return -1;
  143. > 	idx = sk_X509_TRUST_find(trtable, &tmp);
  144.   	if(idx == -1) return -1;
  145.   	return idx + X509_TRUST_COUNT;

crypto/stack/stack.c:243:1: start of procedure sk_find()
    241.   	}
    242.   
    243. > int sk_find(STACK *st, char *data)
    244.   	{
    245.   	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:245:2: 
    243.   int sk_find(STACK *st, char *data)
    244.   	{
    245. > 	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    246.   	}
    247.   int sk_find_ex(STACK *st, char *data)

crypto/stack/stack.c:214:1: start of procedure internal_find()
      212.   	}
      213.   
      214. > static int internal_find(STACK *st, char *data, int ret_val_options)
      215.   	{
      216.   	char **r;

crypto/stack/stack.c:219:5: Taking false branch
      217.   	int i;
      218.   	int (*comp_func)(const void *,const void *);
      219.   	if(st == NULL) return -1;
                 ^
      220.   
      221.   	if (st->comp == NULL)

crypto/stack/stack.c:221:6: Taking true branch
      219.   	if(st == NULL) return -1;
      220.   
      221.   	if (st->comp == NULL)
                  ^
      222.   		{
      223.   		for (i=0; i<st->num; i++)

crypto/stack/stack.c:223:8: 
      221.   	if (st->comp == NULL)
      222.   		{
      223. > 		for (i=0; i<st->num; i++)
      224.   			if (st->data[i] == data)
      225.   				return(i);

crypto/stack/stack.c:223:13: Loop condition is true. Entering loop body
      221.   	if (st->comp == NULL)
      222.   		{
      223.   		for (i=0; i<st->num; i++)
                         ^
      224.   			if (st->data[i] == data)
      225.   				return(i);

crypto/stack/stack.c:224:8: Taking true branch
      222.   		{
      223.   		for (i=0; i<st->num; i++)
      224.   			if (st->data[i] == data)
                    ^
      225.   				return(i);
      226.   		return(-1);

crypto/stack/stack.c:225:5: 
      223.   		for (i=0; i<st->num; i++)
      224.   			if (st->data[i] == data)
      225. > 				return(i);
      226.   		return(-1);
      227.   		}

crypto/stack/stack.c:241:2: return from a call to internal_find
      239.   	if (r == NULL) return(-1);
      240.   	return((int)(r-st->data));
      241.   	}
              ^
      242.   
      243.   int sk_find(STACK *st, char *data)

crypto/stack/stack.c:246:2: return from a call to sk_find
    244.   	{
    245.   	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    246.   	}
            ^
    247.   int sk_find_ex(STACK *st, char *data)
    248.   	{

crypto/x509/x509_trs.c:144:5: Taking false branch
  142.   	if(!trtable) return -1;
  143.   	idx = sk_X509_TRUST_find(trtable, &tmp);
  144.   	if(idx == -1) return -1;
             ^
  145.   	return idx + X509_TRUST_COUNT;
  146.   }

crypto/x509/x509_trs.c:145:2: 
  143.   	idx = sk_X509_TRUST_find(trtable, &tmp);
  144.   	if(idx == -1) return -1;
  145. > 	return idx + X509_TRUST_COUNT;
  146.   }
  147.   

crypto/x509/x509_trs.c:146:1: return from a call to X509_TRUST_get_by_id
  144.   	if(idx == -1) return -1;
  145.   	return idx + X509_TRUST_COUNT;
  146. > }
  147.   
  148.   int X509_TRUST_set(int *t, int trust)

crypto/x509/x509_trs.c:117:5: Taking false branch
115.   	if(id == -1) return 1;
116.   	idx = X509_TRUST_get_by_id(id);
117.   	if(idx == -1) return default_trust(id, x, flags);
           ^
118.   	pt = X509_TRUST_get0(idx);
119.   	return pt->check_trust(pt, x, flags);

crypto/x509/x509_trs.c:118:2: 
116.   	idx = X509_TRUST_get_by_id(id);
117.   	if(idx == -1) return default_trust(id, x, flags);
118. > 	pt = X509_TRUST_get0(idx);
119.   	return pt->check_trust(pt, x, flags);
120.   }

crypto/x509/x509_trs.c:128:1: start of procedure X509_TRUST_get0()
  126.   }
  127.   
  128. > X509_TRUST * X509_TRUST_get0(int idx)
  129.   {
  130.   	if(idx < 0) return NULL;

crypto/x509/x509_trs.c:130:5: Taking true branch
  128.   X509_TRUST * X509_TRUST_get0(int idx)
  129.   {
  130.   	if(idx < 0) return NULL;
             ^
  131.   	if(idx < (int)X509_TRUST_COUNT) return trstandard + idx;
  132.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);

crypto/x509/x509_trs.c:130:14: 
  128.   X509_TRUST * X509_TRUST_get0(int idx)
  129.   {
  130. > 	if(idx < 0) return NULL;
  131.   	if(idx < (int)X509_TRUST_COUNT) return trstandard + idx;
  132.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);

crypto/x509/x509_trs.c:133:1: return from a call to X509_TRUST_get0
  131.   	if(idx < (int)X509_TRUST_COUNT) return trstandard + idx;
  132.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
  133. > }
  134.   
  135.   int X509_TRUST_get_by_id(int id)

crypto/x509/x509_trs.c:119:2: 
117.   	if(idx == -1) return default_trust(id, x, flags);
118.   	pt = X509_TRUST_get0(idx);
119. > 	return pt->check_trust(pt, x, flags);
120.   }
121.   

int X509_check_trust(X509 *x, int id, int flags)
{
	X509_TRUST *pt;
	int idx;
	if(id == -1) return 1;
	idx = X509_TRUST_get_by_id(id);
	if(idx == -1) return default_trust(id, x, flags);
	pt = X509_TRUST_get0(idx);
	return pt->check_trust(pt, x, flags);
}
['int X509_check_trust(X509 *x, int id, int flags)\n{\n\tX509_TRUST *pt;\n\tint idx;\n\tif(id == -1) return 1;\n\tidx = X509_TRUST_get_by_id(id);\n\tif(idx == -1) return default_trust(id, x, flags);\n\tpt = X509_TRUST_get0(idx);\n\treturn pt->check_trust(pt, x, flags);\n}', 'int X509_TRUST_get_by_id(int id)\n{\n\tX509_TRUST tmp;\n\tint idx;\n\tif((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))\n\t\t\t\t return id - X509_TRUST_MIN;\n\ttmp.trust = id;\n\tif(!trtable) return -1;\n\tidx = sk_X509_TRUST_find(trtable, &tmp);\n\tif(idx == -1) return -1;\n\treturn idx + X509_TRUST_COUNT;\n}', 'int sk_find(STACK *st, char *data)\n\t{\n\treturn internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);\n\t}', 'static int internal_find(STACK *st, char *data, int ret_val_options)\n\t{\n\tchar **r;\n\tint i;\n\tint (*comp_func)(const void *,const void *);\n\tif(st == NULL) return -1;\n\tif (st->comp == NULL)\n\t\t{\n\t\tfor (i=0; i<st->num; i++)\n\t\t\tif (st->data[i] == data)\n\t\t\t\treturn(i);\n\t\treturn(-1);\n\t\t}\n\tsk_sort(st);\n\tif (data == NULL) return(-1);\n\tcomp_func=(int (*)(const void *,const void *))(st->comp);\n\tr=(char **)OBJ_bsearch_ex((char *)&data,(char *)st->data,\n\t\tst->num,sizeof(char *),comp_func,ret_val_options);\n\tif (r == NULL) return(-1);\n\treturn((int)(r-st->data));\n\t}', 'X509_TRUST * X509_TRUST_get0(int idx)\n{\n\tif(idx < 0) return NULL;\n\tif(idx < (int)X509_TRUST_COUNT) return trstandard + idx;\n\treturn sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);\n}']