crypto/x509/x509_trs.c:133: error: NULL_DEREFERENCE
  pointer `pt` last assigned on line 132 could be null and is dereferenced at line 133, column 12.
Showing all 41 steps of the trace


crypto/x509/x509_trs.c:115:1: start of procedure X509_check_trust()
113.   }
114.   
115. > int X509_check_trust(X509 *x, int id, int flags)
116.   {
117.       X509_TRUST *pt;

crypto/x509/x509_trs.c:119:9: Taking false branch
117.       X509_TRUST *pt;
118.       int idx;
119.       if (id == -1)
               ^
120.           return 1;
121.       /* We get this as a default value */

crypto/x509/x509_trs.c:122:9: Taking false branch
120.           return 1;
121.       /* We get this as a default value */
122.       if (id == 0) {
               ^
123.           int rv;
124.           rv = obj_trust(NID_anyExtendedKeyUsage, x, 0);

crypto/x509/x509_trs.c:129:5: 
127.           return trust_compat(NULL, x, 0);
128.       }
129. >     idx = X509_TRUST_get_by_id(id);
130.       if (idx == -1)
131.           return default_trust(id, x, flags);

crypto/x509/x509_trs.c:152:1: start of procedure X509_TRUST_get_by_id()
  150.   }
  151.   
  152. > int X509_TRUST_get_by_id(int id)
  153.   {
  154.       X509_TRUST tmp;

crypto/x509/x509_trs.c:156:10: Taking true branch
  154.       X509_TRUST tmp;
  155.       int idx;
  156.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                  ^
  157.           return id - X509_TRUST_MIN;
  158.       tmp.trust = id;

crypto/x509/x509_trs.c:156:36: Taking false branch
  154.       X509_TRUST tmp;
  155.       int idx;
  156.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                                            ^
  157.           return id - X509_TRUST_MIN;
  158.       tmp.trust = id;

crypto/x509/x509_trs.c:158:5: 
  156.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
  157.           return id - X509_TRUST_MIN;
  158. >     tmp.trust = id;
  159.       if (!trtable)
  160.           return -1;

crypto/x509/x509_trs.c:159:10: Taking false branch
  157.           return id - X509_TRUST_MIN;
  158.       tmp.trust = id;
  159.       if (!trtable)
                  ^
  160.           return -1;
  161.       idx = sk_X509_TRUST_find(trtable, &tmp);

crypto/x509/x509_trs.c:161:11: Condition is true
  159.       if (!trtable)
  160.           return -1;
  161.       idx = sk_X509_TRUST_find(trtable, &tmp);
                   ^
  162.       if (idx == -1)
  163.           return -1;

crypto/x509/x509_trs.c:161:11: Condition is true
  159.       if (!trtable)
  160.           return -1;
  161.       idx = sk_X509_TRUST_find(trtable, &tmp);
                   ^
  162.       if (idx == -1)
  163.           return -1;

crypto/x509/x509_trs.c:161:5: 
  159.       if (!trtable)
  160.           return -1;
  161. >     idx = sk_X509_TRUST_find(trtable, &tmp);
  162.       if (idx == -1)
  163.           return -1;

crypto/stack/stack.c:253:1: start of procedure sk_find()
    251.   }
    252.   
    253. > int sk_find(_STACK *st, void *data)
    254.   {
    255.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:255:5: 
    253.   int sk_find(_STACK *st, void *data)
    254.   {
    255. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    256.   }
    257.   

crypto/stack/stack.c:229:1: start of procedure internal_find()
      227.   }
      228.   
      229. > static int internal_find(_STACK *st, void *data, int ret_val_options)
      230.   {
      231.       const void *const *r;

crypto/stack/stack.c:234:9: Taking false branch
      232.       int i;
      233.   
      234.       if (st == NULL)
                     ^
      235.           return -1;
      236.   

crypto/stack/stack.c:237:9: Taking true branch
      235.           return -1;
      236.   
      237.       if (st->comp == NULL) {
                     ^
      238.           for (i = 0; i < st->num; i++)
      239.               if (st->data[i] == data)

crypto/stack/stack.c:238:14: 
      236.   
      237.       if (st->comp == NULL) {
      238. >         for (i = 0; i < st->num; i++)
      239.               if (st->data[i] == data)
      240.                   return (i);

crypto/stack/stack.c:238:21: Loop condition is true. Entering loop body
      236.   
      237.       if (st->comp == NULL) {
      238.           for (i = 0; i < st->num; i++)
                                 ^
      239.               if (st->data[i] == data)
      240.                   return (i);

crypto/stack/stack.c:239:17: Taking true branch
      237.       if (st->comp == NULL) {
      238.           for (i = 0; i < st->num; i++)
      239.               if (st->data[i] == data)
                             ^
      240.                   return (i);
      241.           return (-1);

crypto/stack/stack.c:240:17: 
      238.           for (i = 0; i < st->num; i++)
      239.               if (st->data[i] == data)
      240. >                 return (i);
      241.           return (-1);
      242.       }

crypto/stack/stack.c:251:1: return from a call to internal_find
      249.           return (-1);
      250.       return (int)((char **)r - st->data);
      251. > }
      252.   
      253.   int sk_find(_STACK *st, void *data)

crypto/stack/stack.c:256:1: return from a call to sk_find
    254.   {
    255.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    256. > }
    257.   
    258.   int sk_find_ex(_STACK *st, void *data)

crypto/x509/x509_trs.c:162:9: Taking false branch
  160.           return -1;
  161.       idx = sk_X509_TRUST_find(trtable, &tmp);
  162.       if (idx == -1)
                 ^
  163.           return -1;
  164.       return idx + X509_TRUST_COUNT;

crypto/x509/x509_trs.c:164:5: 
  162.       if (idx == -1)
  163.           return -1;
  164. >     return idx + X509_TRUST_COUNT;
  165.   }
  166.   

crypto/x509/x509_trs.c:165:1: return from a call to X509_TRUST_get_by_id
  163.           return -1;
  164.       return idx + X509_TRUST_COUNT;
  165. > }
  166.   
  167.   int X509_TRUST_set(int *t, int trust)

crypto/x509/x509_trs.c:130:9: Taking false branch
128.       }
129.       idx = X509_TRUST_get_by_id(id);
130.       if (idx == -1)
               ^
131.           return default_trust(id, x, flags);
132.       pt = X509_TRUST_get0(idx);

crypto/x509/x509_trs.c:132:5: 
130.       if (idx == -1)
131.           return default_trust(id, x, flags);
132. >     pt = X509_TRUST_get0(idx);
133.       return pt->check_trust(pt, x, flags);
134.   }

crypto/x509/x509_trs.c:143:1: start of procedure X509_TRUST_get0()
  141.   }
  142.   
  143. > X509_TRUST *X509_TRUST_get0(int idx)
  144.   {
  145.       if (idx < 0)

crypto/x509/x509_trs.c:145:9: Taking false branch
  143.   X509_TRUST *X509_TRUST_get0(int idx)
  144.   {
  145.       if (idx < 0)
                 ^
  146.           return NULL;
  147.       if (idx < (int)X509_TRUST_COUNT)

crypto/x509/x509_trs.c:147:9: Taking false branch
  145.       if (idx < 0)
  146.           return NULL;
  147.       if (idx < (int)X509_TRUST_COUNT)
                 ^
  148.           return trstandard + idx;
  149.       return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);

crypto/x509/x509_trs.c:149:12: Condition is true
  147.       if (idx < (int)X509_TRUST_COUNT)
  148.           return trstandard + idx;
  149.       return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
                    ^
  150.   }
  151.   

crypto/x509/x509_trs.c:149:5: 
  147.       if (idx < (int)X509_TRUST_COUNT)
  148.           return trstandard + idx;
  149. >     return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
  150.   }
  151.   

crypto/stack/stack.c:328:1: start of procedure sk_value()
    326.   }
    327.   
    328. > void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:330:10: Taking false branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                    ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:330:17: Taking false branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                           ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:330:28: Taking true branch
    328.   void *sk_value(const _STACK *st, int i)
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
                                      ^
    331.           return NULL;
    332.       return st->data[i];

crypto/stack/stack.c:331:9: 
    329.   {
    330.       if (!st || (i < 0) || (i >= st->num))
    331. >         return NULL;
    332.       return st->data[i];
    333.   }

crypto/stack/stack.c:333:1: return from a call to sk_value
    331.           return NULL;
    332.       return st->data[i];
    333. > }
    334.   
    335.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_trs.c:150:1: return from a call to X509_TRUST_get0
  148.           return trstandard + idx;
  149.       return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
  150. > }
  151.   
  152.   int X509_TRUST_get_by_id(int id)

crypto/x509/x509_trs.c:133:5: 
131.           return default_trust(id, x, flags);
132.       pt = X509_TRUST_get0(idx);
133. >     return pt->check_trust(pt, x, flags);
134.   }
135.   

int X509_check_trust(X509 *x, int id, int flags)
{
    X509_TRUST *pt;
    int idx;
    if (id == -1)
        return 1;
    if (id == 0) {
        int rv;
        rv = obj_trust(NID_anyExtendedKeyUsage, x, 0);
        if (rv != X509_TRUST_UNTRUSTED)
            return rv;
        return trust_compat(NULL, x, 0);
    }
    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    X509_TRUST *pt;\n    int idx;\n    if (id == -1)\n        return 1;\n    if (id == 0) {\n        int rv;\n        rv = obj_trust(NID_anyExtendedKeyUsage, x, 0);\n        if (rv != X509_TRUST_UNTRUSTED)\n            return rv;\n        return trust_compat(NULL, x, 0);\n    }\n    idx = X509_TRUST_get_by_id(id);\n    if (idx == -1)\n        return default_trust(id, x, flags);\n    pt = X509_TRUST_get0(idx);\n    return pt->check_trust(pt, x, flags);\n}', 'int X509_TRUST_get_by_id(int id)\n{\n    X509_TRUST tmp;\n    int idx;\n    if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))\n        return id - X509_TRUST_MIN;\n    tmp.trust = id;\n    if (!trtable)\n        return -1;\n    idx = sk_X509_TRUST_find(trtable, &tmp);\n    if (idx == -1)\n        return -1;\n    return idx + X509_TRUST_COUNT;\n}', 'int sk_find(_STACK *st, void *data)\n{\n    return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);\n}', 'static int internal_find(_STACK *st, void *data, int ret_val_options)\n{\n    const void *const *r;\n    int i;\n    if (st == NULL)\n        return -1;\n    if (st->comp == NULL) {\n        for (i = 0; i < st->num; i++)\n            if (st->data[i] == data)\n                return (i);\n        return (-1);\n    }\n    sk_sort(st);\n    if (data == NULL)\n        return (-1);\n    r = OBJ_bsearch_ex_(&data, st->data, st->num, sizeof(void *), st->comp,\n                        ret_val_options);\n    if (r == NULL)\n        return (-1);\n    return (int)((char **)r - st->data);\n}', 'X509_TRUST *X509_TRUST_get0(int idx)\n{\n    if (idx < 0)\n        return NULL;\n    if (idx < (int)X509_TRUST_COUNT)\n        return trstandard + idx;\n    return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}']