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


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

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

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

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

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

crypto/x509v3/v3_purp.c:136:10: Taking true branch
  134.       X509_PURPOSE tmp;
  135.       int idx;
  136.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                  ^
  137.           return purpose - X509_PURPOSE_MIN;
  138.       tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:136:43: Taking false branch
  134.       X509_PURPOSE tmp;
  135.       int idx;
  136.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                                                   ^
  137.           return purpose - X509_PURPOSE_MIN;
  138.       tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:138:5: 
  136.       if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
  137.           return purpose - X509_PURPOSE_MIN;
  138. >     tmp.purpose = purpose;
  139.       if (!xptable)
  140.           return -1;

crypto/x509v3/v3_purp.c:139:10: Taking false branch
  137.           return purpose - X509_PURPOSE_MIN;
  138.       tmp.purpose = purpose;
  139.       if (!xptable)
                  ^
  140.           return -1;
  141.       idx = sk_X509_PURPOSE_find(xptable, &tmp);

crypto/x509v3/v3_purp.c:141:5: 
  139.       if (!xptable)
  140.           return -1;
  141. >     idx = sk_X509_PURPOSE_find(xptable, &tmp);
  142.       if (idx == -1)
  143.           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:142:9: Taking false branch
  140.           return -1;
  141.       idx = sk_X509_PURPOSE_find(xptable, &tmp);
  142.       if (idx == -1)
                 ^
  143.           return -1;
  144.       return idx + X509_PURPOSE_COUNT;

crypto/x509v3/v3_purp.c:144:5: 
  142.       if (idx == -1)
  143.           return -1;
  144. >     return idx + X509_PURPOSE_COUNT;
  145.   }
  146.   

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

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

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

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

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

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

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

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