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


crypto/x509/x509_trs.c:65:1: start of procedure X509_check_trust()
63.   }
64.   
65. > int X509_check_trust(X509 *x, int id, int flags)
66.   {
67.       X509_TRUST *pt;

crypto/x509/x509_trs.c:71:9: Taking false branch
69.   
70.       /* We get this as a default value */
71.       if (id == X509_TRUST_DEFAULT)
              ^
72.           return obj_trust(NID_anyExtendedKeyUsage, x,
73.                            flags | X509_TRUST_DO_SS_COMPAT);

crypto/x509/x509_trs.c:74:5: 
72.           return obj_trust(NID_anyExtendedKeyUsage, x,
73.                            flags | X509_TRUST_DO_SS_COMPAT);
74. >     idx = X509_TRUST_get_by_id(id);
75.       if (idx == -1)
76.           return default_trust(id, x, flags);

crypto/x509/x509_trs.c:97:1: start of procedure X509_TRUST_get_by_id()
  95.   }
  96.   
  97. > int X509_TRUST_get_by_id(int id)
  98.   {
  99.       X509_TRUST tmp;

crypto/x509/x509_trs.c:101:10: Taking true branch
  99.       X509_TRUST tmp;
  100.       int idx;
  101.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                  ^
  102.           return id - X509_TRUST_MIN;
  103.       tmp.trust = id;

crypto/x509/x509_trs.c:101:36: Taking false branch
  99.       X509_TRUST tmp;
  100.       int idx;
  101.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                                            ^
  102.           return id - X509_TRUST_MIN;
  103.       tmp.trust = id;

crypto/x509/x509_trs.c:103:5: 
  101.       if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
  102.           return id - X509_TRUST_MIN;
  103. >     tmp.trust = id;
  104.       if (!trtable)
  105.           return -1;

crypto/x509/x509_trs.c:104:10: Taking false branch
  102.           return id - X509_TRUST_MIN;
  103.       tmp.trust = id;
  104.       if (!trtable)
                  ^
  105.           return -1;
  106.       idx = sk_X509_TRUST_find(trtable, &tmp);

crypto/x509/x509_trs.c:106:5: 
  104.       if (!trtable)
  105.           return -1;
  106. >     idx = sk_X509_TRUST_find(trtable, &tmp);
  107.       if (idx == -1)
  108.           return -1;

include/openssl/x509.h:112:1: start of procedure sk_X509_TRUST_find()
    110.   } X509_TRUST;
    111.   
    112. > DEFINE_STACK_OF(X509_TRUST)
    113.   
    114.   /* standard trust ids */

crypto/stack/stack.c:295:1: start of procedure OPENSSL_sk_find()
      293.   }
      294.   
      295. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
      296.   {
      297.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:297:5: 
      295.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
      296.   {
      297. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      298.   }
      299.   

crypto/stack/stack.c:266:1: start of procedure internal_find()
        264.   }
        265.   
        266. > static int internal_find(OPENSSL_STACK *st, const void *data,
        267.                            int ret_val_options)
        268.   {

crypto/stack/stack.c:272:9: Taking false branch
        270.       int i;
        271.   
        272.       if (st == NULL || st->num == 0)
                       ^
        273.           return -1;
        274.   

crypto/stack/stack.c:272:23: Taking false branch
        270.       int i;
        271.   
        272.       if (st == NULL || st->num == 0)
                                     ^
        273.           return -1;
        274.   

crypto/stack/stack.c:275:9: Taking true branch
        273.           return -1;
        274.   
        275.       if (st->comp == NULL) {
                       ^
        276.           for (i = 0; i < st->num; i++)
        277.               if (st->data[i] == data)

crypto/stack/stack.c:276:14: 
        274.   
        275.       if (st->comp == NULL) {
        276. >         for (i = 0; i < st->num; i++)
        277.               if (st->data[i] == data)
        278.                   return i;

crypto/stack/stack.c:276:21: Loop condition is true. Entering loop body
        274.   
        275.       if (st->comp == NULL) {
        276.           for (i = 0; i < st->num; i++)
                                   ^
        277.               if (st->data[i] == data)
        278.                   return i;

crypto/stack/stack.c:277:17: Taking true branch
        275.       if (st->comp == NULL) {
        276.           for (i = 0; i < st->num; i++)
        277.               if (st->data[i] == data)
                               ^
        278.                   return i;
        279.           return -1;

crypto/stack/stack.c:278:17: 
        276.           for (i = 0; i < st->num; i++)
        277.               if (st->data[i] == data)
        278. >                 return i;
        279.           return -1;
        280.       }

crypto/stack/stack.c:293:1: return from a call to internal_find
        291.   
        292.       return r == NULL ? -1 : (int)((const void **)r - st->data);
        293. > }
        294.   
        295.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)

crypto/stack/stack.c:298:1: return from a call to OPENSSL_sk_find
      296.   {
      297.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      298. > }
      299.   
      300.   int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)

include/openssl/x509.h:112:1: return from a call to sk_X509_TRUST_find
    110.   } X509_TRUST;
    111.   
    112. > DEFINE_STACK_OF(X509_TRUST)
    113.   
    114.   /* standard trust ids */

crypto/x509/x509_trs.c:107:9: Taking false branch
  105.           return -1;
  106.       idx = sk_X509_TRUST_find(trtable, &tmp);
  107.       if (idx == -1)
                 ^
  108.           return -1;
  109.       return idx + X509_TRUST_COUNT;

crypto/x509/x509_trs.c:109:5: 
  107.       if (idx == -1)
  108.           return -1;
  109. >     return idx + X509_TRUST_COUNT;
  110.   }
  111.   

crypto/x509/x509_trs.c:110:1: return from a call to X509_TRUST_get_by_id
  108.           return -1;
  109.       return idx + X509_TRUST_COUNT;
  110. > }
  111.   
  112.   int X509_TRUST_set(int *t, int trust)

crypto/x509/x509_trs.c:75:9: Taking false branch
73.                            flags | X509_TRUST_DO_SS_COMPAT);
74.       idx = X509_TRUST_get_by_id(id);
75.       if (idx == -1)
              ^
76.           return default_trust(id, x, flags);
77.       pt = X509_TRUST_get0(idx);

crypto/x509/x509_trs.c:77:5: 
75.       if (idx == -1)
76.           return default_trust(id, x, flags);
77. >     pt = X509_TRUST_get0(idx);
78.       return pt->check_trust(pt, x, flags);
79.   }

crypto/x509/x509_trs.c:88:1: start of procedure X509_TRUST_get0()
  86.   }
  87.   
  88. > X509_TRUST *X509_TRUST_get0(int idx)
  89.   {
  90.       if (idx < 0)

crypto/x509/x509_trs.c:90:9: Taking true branch
  88.   X509_TRUST *X509_TRUST_get0(int idx)
  89.   {
  90.       if (idx < 0)
                ^
  91.           return NULL;
  92.       if (idx < (int)X509_TRUST_COUNT)

crypto/x509/x509_trs.c:91:9: 
  89.   {
  90.       if (idx < 0)
  91. >         return NULL;
  92.       if (idx < (int)X509_TRUST_COUNT)
  93.           return trstandard + idx;

crypto/x509/x509_trs.c:95:1: return from a call to X509_TRUST_get0
  93.           return trstandard + idx;
  94.       return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
  95. > }
  96.   
  97.   int X509_TRUST_get_by_id(int id)

crypto/x509/x509_trs.c:78:5: 
76.           return default_trust(id, x, flags);
77.       pt = X509_TRUST_get0(idx);
78. >     return pt->check_trust(pt, x, flags);
79.   }
80.   

int X509_check_trust(X509 *x, int id, int flags)
{
    X509_TRUST *pt;
    int idx;
    if (id == X509_TRUST_DEFAULT)
        return obj_trust(NID_anyExtendedKeyUsage, x,
                         flags | X509_TRUST_DO_SS_COMPAT);
    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 == X509_TRUST_DEFAULT)\n        return obj_trust(NID_anyExtendedKeyUsage, x,\n                         flags | X509_TRUST_DO_SS_COMPAT);\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 OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)\n{\n    return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);\n}', 'static int internal_find(OPENSSL_STACK *st, const void *data,\n                         int ret_val_options)\n{\n    const void *r;\n    int i;\n    if (st == NULL || st->num == 0)\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    if (!st->sorted) {\n        if (st->num > 1)\n            qsort(st->data, st->num, sizeof(void *), st->comp);\n        st->sorted = 1;\n    }\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    return r == NULL ? -1 : (int)((const void **)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}']