crypto/x509/x509_vfy.c:885: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 874 could be null and is dereferenced by call to `get_crl_delta()` at line 885, column 18.
Showing all 26 steps of the trace


crypto/x509/x509_vfy.c:867:1: start of procedure check_cert()
865.   }
866.   
867. > static int check_cert(X509_STORE_CTX *ctx)
868.   {
869.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:869:5: 
867.   static int check_cert(X509_STORE_CTX *ctx)
868.   {
869. >     X509_CRL *crl = NULL, *dcrl = NULL;
870.       X509 *x;
871.       int ok, cnum;

crypto/x509/x509_vfy.c:873:5: 
871.       int ok, cnum;
872.       unsigned int last_reasons;
873. >     cnum = ctx->error_depth;
874.       x = sk_X509_value(ctx->chain, cnum);
875.       ctx->current_cert = x;

crypto/x509/x509_vfy.c:874:9: Condition is true
872.       unsigned int last_reasons;
873.       cnum = ctx->error_depth;
874.       x = sk_X509_value(ctx->chain, cnum);
               ^
875.       ctx->current_cert = x;
876.       ctx->current_issuer = NULL;

crypto/x509/x509_vfy.c:874:5: 
872.       unsigned int last_reasons;
873.       cnum = ctx->error_depth;
874. >     x = sk_X509_value(ctx->chain, cnum);
875.       ctx->current_cert = x;
876.       ctx->current_issuer = NULL;

crypto/stack/stack.c:334:1: start of procedure sk_value()
  332.   }
  333.   
  334. > void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:336:10: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                  ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:17: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                         ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:28: Taking true branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:337:9: 
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
  337. >         return NULL;
  338.       return st->data[i];
  339.   }

crypto/stack/stack.c:339:1: return from a call to sk_value
  337.           return NULL;
  338.       return st->data[i];
  339. > }
  340.   
  341.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:875:5: 
873.       cnum = ctx->error_depth;
874.       x = sk_X509_value(ctx->chain, cnum);
875. >     ctx->current_cert = x;
876.       ctx->current_issuer = NULL;
877.       ctx->current_crl_score = 0;

crypto/x509/x509_vfy.c:876:5: 
874.       x = sk_X509_value(ctx->chain, cnum);
875.       ctx->current_cert = x;
876. >     ctx->current_issuer = NULL;
877.       ctx->current_crl_score = 0;
878.       ctx->current_reasons = 0;

crypto/x509/x509_vfy.c:877:5: 
875.       ctx->current_cert = x;
876.       ctx->current_issuer = NULL;
877. >     ctx->current_crl_score = 0;
878.       ctx->current_reasons = 0;
879.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {

crypto/x509/x509_vfy.c:878:5: 
876.       ctx->current_issuer = NULL;
877.       ctx->current_crl_score = 0;
878. >     ctx->current_reasons = 0;
879.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
880.           last_reasons = ctx->current_reasons;

crypto/x509/x509_vfy.c:879:12: Loop condition is true. Entering loop body
877.       ctx->current_crl_score = 0;
878.       ctx->current_reasons = 0;
879.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
                  ^
880.           last_reasons = ctx->current_reasons;
881.           /* Try to retrieve relevant CRL */

crypto/x509/x509_vfy.c:880:9: 
878.       ctx->current_reasons = 0;
879.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
880. >         last_reasons = ctx->current_reasons;
881.           /* Try to retrieve relevant CRL */
882.           if (ctx->get_crl)

crypto/x509/x509_vfy.c:882:13: Taking false branch
880.           last_reasons = ctx->current_reasons;
881.           /* Try to retrieve relevant CRL */
882.           if (ctx->get_crl)
                   ^
883.               ok = ctx->get_crl(ctx, &crl, x);
884.           else

crypto/x509/x509_vfy.c:885:13: 
883.               ok = ctx->get_crl(ctx, &crl, x);
884.           else
885. >             ok = get_crl_delta(ctx, &crl, &dcrl, x);
886.           /*
887.            * If error looking up CRL, nothing we can do except notify callback

crypto/x509/x509_vfy.c:1434:1: start of procedure get_crl_delta()
  1432.    */
  1433.   
  1434. > static int get_crl_delta(X509_STORE_CTX *ctx,
  1435.                            X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
  1436.   {

crypto/x509/x509_vfy.c:1438:5: 
  1436.   {
  1437.       int ok;
  1438. >     X509 *issuer = NULL;
  1439.       int crl_score = 0;
  1440.       unsigned int reasons;

crypto/x509/x509_vfy.c:1439:5: 
  1437.       int ok;
  1438.       X509 *issuer = NULL;
  1439. >     int crl_score = 0;
  1440.       unsigned int reasons;
  1441.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:1441:5: 
  1439.       int crl_score = 0;
  1440.       unsigned int reasons;
  1441. >     X509_CRL *crl = NULL, *dcrl = NULL;
  1442.       STACK_OF(X509_CRL) *skcrl;
  1443.       X509_NAME *nm = X509_get_issuer_name(x);

crypto/x509/x509_vfy.c:1443:5: 
  1441.       X509_CRL *crl = NULL, *dcrl = NULL;
  1442.       STACK_OF(X509_CRL) *skcrl;
  1443. >     X509_NAME *nm = X509_get_issuer_name(x);
  1444.       reasons = ctx->current_reasons;
  1445.       ok = get_crl_sk(ctx, &crl, &dcrl,

crypto/x509/x509_cmp.c:130:1: start of procedure X509_get_issuer_name()
    128.   }
    129.   
    130. > X509_NAME *X509_get_issuer_name(X509 *a)
    131.   {
    132.       return (a->cert_info->issuer);

crypto/x509/x509_cmp.c:132:5: 
    130.   X509_NAME *X509_get_issuer_name(X509 *a)
    131.   {
    132. >     return (a->cert_info->issuer);
    133.   }
    134.   
