crypto/x509v3/v3_purp.c:92: error: NULL_DEREFERENCE
  pointer `pt` last assigned on line 91 could be null and is dereferenced at line 92, column 12.
Showing all 34 steps of the trace


crypto/x509v3/v3_purp.c:78:1: start of procedure X509_check_purpose()
76.    * things.
77.    */
78. > int X509_check_purpose(X509 *x, int id, int ca)
79.   {
80.       int idx;

crypto/x509v3/v3_purp.c:83:5: Skipping x509v3_cache_extensions(): empty list of specs
81.       const X509_PURPOSE *pt;
82.   
83.       x509v3_cache_extensions(x);
          ^
84.   
85.       /* Return if side-effect only call */

crypto/x509v3/v3_purp.c:86:9: Taking false branch
84.   
85.       /* Return if side-effect only call */
86.       if (id == -1)
              ^
87.           return 1;
88.       idx = X509_PURPOSE_get_by_id(id);

crypto/x509v3/v3_purp.c:88:5: 
86.       if (id == -1)
87.           return 1;
88. >     idx = X509_PURPOSE_get_by_id(id);
89.       if (idx == -1)
90.           return -1;

crypto/x509v3/v3_purp.c:133:1: start of procedure X509_PURPOSE_get_by_id()
  131.   }
  132.   
  133. > int X509_PURPOSE_get_by_id(int purpose)
  134.   {
  135.       X509_PURPOSE tmp;

crypto/x509v3/v3_purp.c:138:10: Taking true branch
  136.       int idx;
  137.   
  138.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                  ^
  139.           return purpose - X509_PURPOSE_MIN;
  140.       if (xptable == NULL)

crypto/x509v3/v3_purp.c:138:43: Taking false branch
  136.       int idx;
  137.   
  138.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                                                   ^
  139.           return purpose - X509_PURPOSE_MIN;
  140.       if (xptable == NULL)

crypto/x509v3/v3_purp.c:140:9: Taking false branch
  138.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
  139.           return purpose - X509_PURPOSE_MIN;
  140.       if (xptable == NULL)
                 ^
  141.           return -1;
  142.       tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:142:5: 
  140.       if (xptable == NULL)
  141.           return -1;
  142. >     tmp.purpose = purpose;
  143.       idx = sk_X509_PURPOSE_find(xptable, &tmp);
  144.       if (idx < 0)

crypto/x509v3/v3_purp.c:143:5: 
  141.           return -1;
  142.       tmp.purpose = purpose;
  143. >     idx = sk_X509_PURPOSE_find(xptable, &tmp);
  144.       if (idx < 0)
  145.           return -1;

include/openssl/x509v3.h:448:1: start of procedure sk_X509_PURPOSE_find()
    446.   # define X509V3_ADD_SILENT               0x10
    447.   
    448. > DEFINE_STACK_OF(X509_PURPOSE)
    449.   
    450.   DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)

crypto/stack/stack.c:316:1: start of procedure OPENSSL_sk_find()
      314.   }
      315.   
      316. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
      317.   {
      318.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:318:5: 
      316.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
      317.   {
      318. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      319.   }
      320.   

crypto/stack/stack.c:287:1: start of procedure internal_find()
        285.   }
        286.   
        287. > static int internal_find(OPENSSL_STACK *st, const void *data,
        288.                            int ret_val_options)
        289.   {

crypto/stack/stack.c:293:9: Taking false branch
        291.       int i;
        292.   
        293.       if (st == NULL || st->num == 0)
                       ^
        294.           return -1;
        295.   

crypto/stack/stack.c:293:23: Taking false branch
        291.       int i;
        292.   
        293.       if (st == NULL || st->num == 0)
                                     ^
        294.           return -1;
        295.   

crypto/stack/stack.c:296:9: Taking true branch
        294.           return -1;
        295.   
        296.       if (st->comp == NULL) {
                       ^
        297.           for (i = 0; i < st->num; i++)
        298.               if (st->data[i] == data)

crypto/stack/stack.c:297:14: 
        295.   
        296.       if (st->comp == NULL) {
        297. >         for (i = 0; i < st->num; i++)
        298.               if (st->data[i] == data)
        299.                   return i;

crypto/stack/stack.c:297:21: Loop condition is true. Entering loop body
        295.   
        296.       if (st->comp == NULL) {
        297.           for (i = 0; i < st->num; i++)
                                   ^
        298.               if (st->data[i] == data)
        299.                   return i;

crypto/stack/stack.c:298:17: Taking true branch
        296.       if (st->comp == NULL) {
        297.           for (i = 0; i < st->num; i++)
        298.               if (st->data[i] == data)
                               ^
        299.                   return i;
        300.           return -1;

crypto/stack/stack.c:299:17: 
        297.           for (i = 0; i < st->num; i++)
        298.               if (st->data[i] == data)
        299. >                 return i;
        300.           return -1;
        301.       }

crypto/stack/stack.c:314:1: return from a call to internal_find
        312.   
        313.       return r == NULL ? -1 : (int)((const void **)r - st->data);
        314. > }
        315.   
        316.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)

crypto/stack/stack.c:319:1: return from a call to OPENSSL_sk_find
      317.   {
      318.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
      319. > }
      320.   
      321.   int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)

include/openssl/x509v3.h:448:1: return from a call to sk_X509_PURPOSE_find
    446.   # define X509V3_ADD_SILENT               0x10
    447.   
    448. > DEFINE_STACK_OF(X509_PURPOSE)
    449.   
    450.   DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)

crypto/x509v3/v3_purp.c:144:9: Taking false branch
  142.       tmp.purpose = purpose;
  143.       idx = sk_X509_PURPOSE_find(xptable, &tmp);
  144.       if (idx < 0)
                 ^
  145.           return -1;
  146.       return idx + X509_PURPOSE_COUNT;

crypto/x509v3/v3_purp.c:146:5: 
  144.       if (idx < 0)
  145.           return -1;
  146. >     return idx + X509_PURPOSE_COUNT;
  147.   }
  148.   

crypto/x509v3/v3_purp.c:147:1: return from a call to X509_PURPOSE_get_by_id
  145.           return -1;
  146.       return idx + X509_PURPOSE_COUNT;
  147. > }
  148.   
  149.   int X509_PURPOSE_add(int id, int trust, int flags,

crypto/x509v3/v3_purp.c:89:9: Taking false branch
87.           return 1;
88.       idx = X509_PURPOSE_get_by_id(id);
89.       if (idx == -1)
              ^
90.           return -1;
91.       pt = X509_PURPOSE_get0(idx);

crypto/x509v3/v3_purp.c:91:5: 
89.       if (idx == -1)
90.           return -1;
91. >     pt = X509_PURPOSE_get0(idx);
92.       return pt->check_purpose(pt, x, ca);
93.   }

crypto/x509v3/v3_purp.c:112:1: start of procedure X509_PURPOSE_get0()
  110.   }
  111.   
  112. > X509_PURPOSE *X509_PURPOSE_get0(int idx)
  113.   {
  114.       if (idx < 0)

crypto/x509v3/v3_purp.c:114:9: Taking true branch
  112.   X509_PURPOSE *X509_PURPOSE_get0(int idx)
  113.   {
  114.       if (idx < 0)
                 ^
  115.           return NULL;
  116.       if (idx < (int)X509_PURPOSE_COUNT)

crypto/x509v3/v3_purp.c:115:9: 
  113.   {
  114.       if (idx < 0)
  115. >         return NULL;
  116.       if (idx < (int)X509_PURPOSE_COUNT)
  117.           return xstandard + idx;

crypto/x509v3/v3_purp.c:119:1: return from a call to X509_PURPOSE_get0
  117.           return xstandard + idx;
  118.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  119. > }
  120.   
  121.   int X509_PURPOSE_get_by_sname(const char *sname)

crypto/x509v3/v3_purp.c:92:5: 
90.           return -1;
91.       pt = X509_PURPOSE_get0(idx);
92. >     return pt->check_purpose(pt, x, ca);
93.   }
94.   
