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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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}']