crypto/x509/x509_vfy.c:2162: error: NULL_DEREFERENCE
  pointer `ptmp` last assigned on line 2158 could be null and is dereferenced at line 2162, column 21.
Showing all 22 steps of the trace


crypto/x509/x509_vfy.c:2129:1: start of procedure X509_STORE_CTX_purpose_inherit()
2127.    */
2128.   
2129. > int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
2130.                                      int purpose, int trust)
2131.   {

crypto/x509/x509_vfy.c:2134:10: Taking true branch
2132.       int idx;
2133.       /* If purpose not set use default */
2134.       if (!purpose)
                 ^
2135.           purpose = def_purpose;
2136.       /* If we have a purpose then check it is valid */

crypto/x509/x509_vfy.c:2135:9: 
2133.       /* If purpose not set use default */
2134.       if (!purpose)
2135. >         purpose = def_purpose;
2136.       /* If we have a purpose then check it is valid */
2137.       if (purpose) {

crypto/x509/x509_vfy.c:2137:9: Taking true branch
2135.           purpose = def_purpose;
2136.       /* If we have a purpose then check it is valid */
2137.       if (purpose) {
                ^
2138.           X509_PURPOSE *ptmp;
2139.           idx = X509_PURPOSE_get_by_id(purpose);

crypto/x509/x509_vfy.c:2139:9: Skipping X509_PURPOSE_get_by_id(): empty list of specs
2137.       if (purpose) {
2138.           X509_PURPOSE *ptmp;
2139.           idx = X509_PURPOSE_get_by_id(purpose);
                ^
2140.           if (idx == -1) {
2141.               X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,

crypto/x509/x509_vfy.c:2140:13: Taking false branch
2138.           X509_PURPOSE *ptmp;
2139.           idx = X509_PURPOSE_get_by_id(purpose);
2140.           if (idx == -1) {
                    ^
2141.               X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
2142.                       X509_R_UNKNOWN_PURPOSE_ID);

crypto/x509/x509_vfy.c:2145:9: 
2143.               return 0;
2144.           }
2145. >         ptmp = X509_PURPOSE_get0(idx);
2146.           if (ptmp->trust == X509_TRUST_DEFAULT) {
2147.               idx = X509_PURPOSE_get_by_id(def_purpose);

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 false 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:115:9: Taking true branch
  113.       if (idx < 0)
  114.           return NULL;
  115.       if (idx < (int)X509_PURPOSE_COUNT)
                 ^
  116.           return xstandard + idx;
  117.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:116:9: 
  114.           return NULL;
  115.       if (idx < (int)X509_PURPOSE_COUNT)
  116. >         return xstandard + idx;
  117.       return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  118.   }

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/x509/x509_vfy.c:2146:13: Taking true branch
2144.           }
2145.           ptmp = X509_PURPOSE_get0(idx);
2146.           if (ptmp->trust == X509_TRUST_DEFAULT) {
                    ^
2147.               idx = X509_PURPOSE_get_by_id(def_purpose);
2148.               /*

crypto/x509/x509_vfy.c:2147:13: Skipping X509_PURPOSE_get_by_id(): empty list of specs
2145.           ptmp = X509_PURPOSE_get0(idx);
2146.           if (ptmp->trust == X509_TRUST_DEFAULT) {
2147.               idx = X509_PURPOSE_get_by_id(def_purpose);
                    ^
2148.               /*
2149.                * XXX: In the two callers above def_purpose is always 0, which is

crypto/x509/x509_vfy.c:2153:17: Taking false branch
2151.                * X509_TRUST_DEFAULT case actually supposed to be handled?
2152.                */
2153.               if (idx == -1) {
                        ^
2154.                   X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
2155.                           X509_R_UNKNOWN_PURPOSE_ID);

crypto/x509/x509_vfy.c:2158:13: 
2156.                   return 0;
2157.               }
2158. >             ptmp = X509_PURPOSE_get0(idx);
2159.           }
2160.           /* If trust not set then get from purpose default */

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/x509/x509_vfy.c:2161:14: Taking true branch
2159.           }
2160.           /* If trust not set then get from purpose default */
2161.           if (!trust)
                     ^
2162.               trust = ptmp->trust;
2163.       }

crypto/x509/x509_vfy.c:2162:13: 
2160.           /* If trust not set then get from purpose default */
2161.           if (!trust)
2162. >             trust = ptmp->trust;
2163.       }
2164.       if (trust) {
