crypto/x509/x509_vfy.c:851: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 844 could be null and is dereferenced at line 851, column 9.
Showing all 17 steps of the trace


crypto/x509/x509_vfy.c:839:1: start of procedure check_cert()
837.   }
838.   
839. > static int check_cert(X509_STORE_CTX *ctx)
840.   {
841.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:841:5: 
839.   static int check_cert(X509_STORE_CTX *ctx)
840.   {
841. >     X509_CRL *crl = NULL, *dcrl = NULL;
842.       int ok = 0;
843.       int cnum = ctx->error_depth;

crypto/x509/x509_vfy.c:842:5: 
840.   {
841.       X509_CRL *crl = NULL, *dcrl = NULL;
842. >     int ok = 0;
843.       int cnum = ctx->error_depth;
844.       X509 *x = sk_X509_value(ctx->chain, cnum);

crypto/x509/x509_vfy.c:843:5: 
841.       X509_CRL *crl = NULL, *dcrl = NULL;
842.       int ok = 0;
843. >     int cnum = ctx->error_depth;
844.       X509 *x = sk_X509_value(ctx->chain, cnum);
845.   

crypto/x509/x509_vfy.c:844:5: 
842.       int ok = 0;
843.       int cnum = ctx->error_depth;
844. >     X509 *x = sk_X509_value(ctx->chain, cnum);
845.   
846.       ctx->current_cert = x;

include/openssl/x509.h:100:1: start of procedure sk_X509_value()
  98.   typedef struct x509_cinf_st X509_CINF;
  99.   
  100. > DEFINE_STACK_OF(X509)
  101.   
  102.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:284:1: start of procedure OPENSSL_sk_value()
    282.   }
    283.   
    284. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:286:9: Taking false branch
    284.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    287.           return NULL;
    288.       return (void *)st->data[i];

crypto/stack/stack.c:286:23: Taking true branch
    284.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)
                                 ^
    287.           return NULL;
    288.       return (void *)st->data[i];

crypto/stack/stack.c:287:9: 
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)
    287. >         return NULL;
    288.       return (void *)st->data[i];
    289.   }

crypto/stack/stack.c:289:1: return from a call to OPENSSL_sk_value
    287.           return NULL;
    288.       return (void *)st->data[i];
    289. > }
    290.   
    291.   void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)

include/openssl/x509.h:100:1: return from a call to sk_X509_value
  98.   typedef struct x509_cinf_st X509_CINF;
  99.   
  100. > DEFINE_STACK_OF(X509)
  101.   
  102.   /* This is used for a table of trust checking functions */

crypto/x509/x509_vfy.c:846:5: 
844.       X509 *x = sk_X509_value(ctx->chain, cnum);
845.   
846. >     ctx->current_cert = x;
847.       ctx->current_issuer = NULL;
848.       ctx->current_crl_score = 0;

crypto/x509/x509_vfy.c:847:5: 
845.   
846.       ctx->current_cert = x;
847. >     ctx->current_issuer = NULL;
848.       ctx->current_crl_score = 0;
849.       ctx->current_reasons = 0;

crypto/x509/x509_vfy.c:848:5: 
846.       ctx->current_cert = x;
847.       ctx->current_issuer = NULL;
848. >     ctx->current_crl_score = 0;
849.       ctx->current_reasons = 0;
850.   

crypto/x509/x509_vfy.c:849:5: 
847.       ctx->current_issuer = NULL;
848.       ctx->current_crl_score = 0;
849. >     ctx->current_reasons = 0;
850.   
851.       if (x->ex_flags & EXFLAG_PROXY)

crypto/x509/x509_vfy.c:851:9: 
849.       ctx->current_reasons = 0;
850.   
851. >     if (x->ex_flags & EXFLAG_PROXY)
852.           return 1;
853.   
