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


crypto/x509/x509_vfy.c:859:1: start of procedure check_cert()
857.   }
858.   
859. > static int check_cert(X509_STORE_CTX *ctx)
860.   {
861.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:861:5: 
859.   static int check_cert(X509_STORE_CTX *ctx)
860.   {
861. >     X509_CRL *crl = NULL, *dcrl = NULL;
862.       X509 *x;
863.       int ok, cnum;

crypto/x509/x509_vfy.c:865:5: 
863.       int ok, cnum;
864.       unsigned int last_reasons;
865. >     cnum = ctx->error_depth;
866.       x = sk_X509_value(ctx->chain, cnum);
867.       ctx->current_cert = x;

crypto/x509/x509_vfy.c:866:9: Condition is true
864.       unsigned int last_reasons;
865.       cnum = ctx->error_depth;
866.       x = sk_X509_value(ctx->chain, cnum);
               ^
867.       ctx->current_cert = x;
868.       ctx->current_issuer = NULL;

crypto/x509/x509_vfy.c:866:5: 
864.       unsigned int last_reasons;
865.       cnum = ctx->error_depth;
866. >     x = sk_X509_value(ctx->chain, cnum);
867.       ctx->current_cert = x;
868.       ctx->current_issuer = NULL;

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

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

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

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

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

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

crypto/x509/x509_vfy.c:867:5: 
865.       cnum = ctx->error_depth;
866.       x = sk_X509_value(ctx->chain, cnum);
867. >     ctx->current_cert = x;
868.       ctx->current_issuer = NULL;
869.       ctx->current_crl_score = 0;

crypto/x509/x509_vfy.c:868:5: 
866.       x = sk_X509_value(ctx->chain, cnum);
867.       ctx->current_cert = x;
868. >     ctx->current_issuer = NULL;
869.       ctx->current_crl_score = 0;
870.       ctx->current_reasons = 0;

crypto/x509/x509_vfy.c:869:5: 
867.       ctx->current_cert = x;
868.       ctx->current_issuer = NULL;
869. >     ctx->current_crl_score = 0;
870.       ctx->current_reasons = 0;
871.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {

crypto/x509/x509_vfy.c:870:5: 
868.       ctx->current_issuer = NULL;
869.       ctx->current_crl_score = 0;
870. >     ctx->current_reasons = 0;
871.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
872.           last_reasons = ctx->current_reasons;

crypto/x509/x509_vfy.c:871:12: Loop condition is true. Entering loop body
869.       ctx->current_crl_score = 0;
870.       ctx->current_reasons = 0;
871.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
                  ^
872.           last_reasons = ctx->current_reasons;
873.           /* Try to retrieve relevant CRL */

crypto/x509/x509_vfy.c:872:9: 
870.       ctx->current_reasons = 0;
871.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
872. >         last_reasons = ctx->current_reasons;
873.           /* Try to retrieve relevant CRL */
874.           if (ctx->get_crl)

crypto/x509/x509_vfy.c:874:13: Taking false branch
872.           last_reasons = ctx->current_reasons;
873.           /* Try to retrieve relevant CRL */
874.           if (ctx->get_crl)
                   ^
875.               ok = ctx->get_crl(ctx, &crl, x);
876.           else

crypto/x509/x509_vfy.c:877:13: 
875.               ok = ctx->get_crl(ctx, &crl, x);
876.           else
877. >             ok = get_crl_delta(ctx, &crl, &dcrl, x);
878.           /*
879.            * If error looking up CRL, nothing we can do except notify callback

crypto/x509/x509_vfy.c:1426:1: start of procedure get_crl_delta()
  1424.    */
  1425.   
  1426. > static int get_crl_delta(X509_STORE_CTX *ctx,
  1427.                            X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
  1428.   {

crypto/x509/x509_vfy.c:1430:5: 
  1428.   {
  1429.       int ok;
  1430. >     X509 *issuer = NULL;
  1431.       int crl_score = 0;
  1432.       unsigned int reasons;

crypto/x509/x509_vfy.c:1431:5: 
  1429.       int ok;
  1430.       X509 *issuer = NULL;
  1431. >     int crl_score = 0;
  1432.       unsigned int reasons;
  1433.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:1433:5: 
  1431.       int crl_score = 0;
  1432.       unsigned int reasons;
  1433. >     X509_CRL *crl = NULL, *dcrl = NULL;
  1434.       STACK_OF(X509_CRL) *skcrl;
  1435.       X509_NAME *nm = X509_get_issuer_name(x);

crypto/x509/x509_vfy.c:1435:5: 
  1433.       X509_CRL *crl = NULL, *dcrl = NULL;
  1434.       STACK_OF(X509_CRL) *skcrl;
  1435. >     X509_NAME *nm = X509_get_issuer_name(x);
  1436.       reasons = ctx->current_reasons;
  1437.       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.   
