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


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

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

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

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

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

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

crypto/stack/stack.c:381:1: start of procedure OPENSSL_sk_value()
    379.   }
    380.   
    381. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:383:9: Taking false branch
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    384.           return NULL;
    385.       return (void *)st->data[i];

crypto/stack/stack.c:383:23: Taking true branch
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
                                 ^
    384.           return NULL;
    385.       return (void *)st->data[i];

crypto/stack/stack.c:384:9: 
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
    384. >         return NULL;
    385.       return (void *)st->data[i];
    386.   }

crypto/stack/stack.c:386:1: return from a call to OPENSSL_sk_value
    384.           return NULL;
    385.       return (void *)st->data[i];
    386. > }
    387.   
    388.   void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)

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

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

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

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

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

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