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


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

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

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

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

crypto/x509/x509_vfy.c:843:5: 
841.       int ok = 0;
842.       int cnum = ctx->error_depth;
843. >     X509 *x = sk_X509_value(ctx->chain, cnum);
844.   
845.       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:345:1: start of procedure OPENSSL_sk_value()
    343.   }
    344.   
    345. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    346.   {
    347.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:347:9: Taking false branch
    345.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    346.   {
    347.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    348.           return NULL;
    349.       return (void *)st->data[i];

crypto/stack/stack.c:347:23: Taking true branch
    345.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    346.   {
    347.       if (st == NULL || i < 0 || i >= st->num)
                                 ^
    348.           return NULL;
    349.       return (void *)st->data[i];

crypto/stack/stack.c:348:9: 
    346.   {
    347.       if (st == NULL || i < 0 || i >= st->num)
    348. >         return NULL;
    349.       return (void *)st->data[i];
    350.   }

crypto/stack/stack.c:350:1: return from a call to OPENSSL_sk_value
    348.           return NULL;
    349.       return (void *)st->data[i];
    350. > }
    351.   
    352.   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:845:5: 
843.       X509 *x = sk_X509_value(ctx->chain, cnum);
844.   
845. >     ctx->current_cert = x;
846.       ctx->current_issuer = NULL;
847.       ctx->current_crl_score = 0;

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

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

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

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