crypto/x509/x509_vfy.c:2271: error: NULL_DEREFERENCE
  pointer `cert` last assigned on line 2270 could be null and is dereferenced by call to `cert_self_signed()` at line 2271, column 14.
Showing all 19 steps of the trace


crypto/x509/x509_vfy.c:2266:1: start of procedure build_chain()
2264.   }
2265.   
2266. > static int build_chain(X509_STORE_CTX *ctx)
2267.   {
2268.       int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;

crypto/x509/x509_vfy.c:2268:5: 
2266.   static int build_chain(X509_STORE_CTX *ctx)
2267.   {
2268. >     int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;
2269.       int num = sk_X509_num(ctx->chain);
2270.       X509 *cert = sk_X509_value(ctx->chain, num - 1);

crypto/x509/x509_vfy.c:2269:15: Condition is true
2267.   {
2268.       int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;
2269.       int num = sk_X509_num(ctx->chain);
                      ^
2270.       X509 *cert = sk_X509_value(ctx->chain, num - 1);
2271.       int ss = cert_self_signed(cert);

crypto/x509/x509_vfy.c:2269:5: 
2267.   {
2268.       int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;
2269. >     int num = sk_X509_num(ctx->chain);
2270.       X509 *cert = sk_X509_value(ctx->chain, num - 1);
2271.       int ss = cert_self_signed(cert);

crypto/stack/stack.c:317:1: start of procedure sk_num()
  315.   }
  316.   
  317. > int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)

crypto/stack/stack.c:319:9: Taking false branch
  317.   int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)
                 ^
  320.           return -1;
  321.       return st->num;

crypto/stack/stack.c:321:5: 
  319.       if (st == NULL)
  320.           return -1;
  321. >     return st->num;
  322.   }
  323.   

crypto/stack/stack.c:322:1: return from a call to sk_num
  320.           return -1;
  321.       return st->num;
  322. > }
  323.   
  324.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:2270:18: Condition is true
2268.       int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;
2269.       int num = sk_X509_num(ctx->chain);
2270.       X509 *cert = sk_X509_value(ctx->chain, num - 1);
                         ^
2271.       int ss = cert_self_signed(cert);
2272.       STACK_OF(X509) *sktmp = NULL;

crypto/x509/x509_vfy.c:2270:5: 
2268.       int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb;
2269.       int num = sk_X509_num(ctx->chain);
2270. >     X509 *cert = sk_X509_value(ctx->chain, num - 1);
2271.       int ss = cert_self_signed(cert);
2272.       STACK_OF(X509) *sktmp = NULL;

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

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

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

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

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

crypto/x509/x509_vfy.c:2271:5: 
2269.       int num = sk_X509_num(ctx->chain);
2270.       X509 *cert = sk_X509_value(ctx->chain, num - 1);
2271. >     int ss = cert_self_signed(cert);
2272.       STACK_OF(X509) *sktmp = NULL;
2273.       unsigned int search;

crypto/x509/x509_vfy.c:152:1: start of procedure cert_self_signed()
  150.   
  151.   /* Return 1 is a certificate is self signed */
  152. > static int cert_self_signed(X509 *x)
  153.   {
  154.       /*

crypto/x509/x509_vfy.c:159:5: Skipping X509_check_purpose(): empty list of specs
  157.        * parse errors, rather than memory pressure!
  158.        */
  159.       X509_check_purpose(x, -1, 0);
             ^
  160.       if (x->ex_flags & EXFLAG_SS)
  161.           return 1;

crypto/x509/x509_vfy.c:160:9: 
  158.        */
  159.       X509_check_purpose(x, -1, 0);
  160. >     if (x->ex_flags & EXFLAG_SS)
  161.           return 1;
  162.       else
