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


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

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

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

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

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

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

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

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

crypto/x509/x509_trs.c:142:2: Skipping sk_find(): empty list of specs
  140.   	tmp.trust = id;
  141.   	if(!trtable) return -1;
  142.   	idx = sk_X509_TRUST_find(trtable, &tmp);
          ^
  143.   	if(idx == -1) return -1;
  144.   	return idx + X509_TRUST_COUNT;

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

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

crypto/x509/x509_trs.c:145:1: return from a call to X509_TRUST_get_by_id
  143.   	if(idx == -1) return -1;
  144.   	return idx + X509_TRUST_COUNT;
  145. > }
  146.   
  147.   int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),

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

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

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

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

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

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

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

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}', 'X509_TRUST * X509_TRUST_get0(int idx)\n{\n\tif(idx < 0) return NULL;\n\tif(idx < X509_TRUST_COUNT) return trstandard + idx;\n\treturn sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);\n}']