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


crypto/x509/x509_vfy.c:822:1: start of procedure check_cert()
820.   }
821.   
822. > static int check_cert(X509_STORE_CTX *ctx)
823.   {
824.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:824:5: 
822.   static int check_cert(X509_STORE_CTX *ctx)
823.   {
824. >     X509_CRL *crl = NULL, *dcrl = NULL;
825.       X509 *x;
826.       int ok, cnum;

crypto/x509/x509_vfy.c:828:5: 
826.       int ok, cnum;
827.       unsigned int last_reasons;
828. >     cnum = ctx->error_depth;
829.       x = sk_X509_value(ctx->chain, cnum);
830.       ctx->current_cert = x;

crypto/x509/x509_vfy.c:829:9: Condition is true
827.       unsigned int last_reasons;
828.       cnum = ctx->error_depth;
829.       x = sk_X509_value(ctx->chain, cnum);
               ^
830.       ctx->current_cert = x;
831.       ctx->current_issuer = NULL;

crypto/x509/x509_vfy.c:829:5: 
827.       unsigned int last_reasons;
828.       cnum = ctx->error_depth;
829. >     x = sk_X509_value(ctx->chain, cnum);
830.       ctx->current_cert = x;
831.       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:830:5: 
828.       cnum = ctx->error_depth;
829.       x = sk_X509_value(ctx->chain, cnum);
830. >     ctx->current_cert = x;
831.       ctx->current_issuer = NULL;
832.       ctx->current_crl_score = 0;

crypto/x509/x509_vfy.c:831:5: 
829.       x = sk_X509_value(ctx->chain, cnum);
830.       ctx->current_cert = x;
831. >     ctx->current_issuer = NULL;
832.       ctx->current_crl_score = 0;
833.       ctx->current_reasons = 0;

crypto/x509/x509_vfy.c:832:5: 
830.       ctx->current_cert = x;
831.       ctx->current_issuer = NULL;
832. >     ctx->current_crl_score = 0;
833.       ctx->current_reasons = 0;
834.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {

crypto/x509/x509_vfy.c:833:5: 
831.       ctx->current_issuer = NULL;
832.       ctx->current_crl_score = 0;
833. >     ctx->current_reasons = 0;
834.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
835.           last_reasons = ctx->current_reasons;

crypto/x509/x509_vfy.c:834:12: Loop condition is true. Entering loop body
832.       ctx->current_crl_score = 0;
833.       ctx->current_reasons = 0;
834.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
                  ^
835.           last_reasons = ctx->current_reasons;
836.           /* Try to retrieve relevant CRL */

crypto/x509/x509_vfy.c:835:9: 
833.       ctx->current_reasons = 0;
834.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
835. >         last_reasons = ctx->current_reasons;
836.           /* Try to retrieve relevant CRL */
837.           if (ctx->get_crl)

crypto/x509/x509_vfy.c:837:13: Taking false branch
835.           last_reasons = ctx->current_reasons;
836.           /* Try to retrieve relevant CRL */
837.           if (ctx->get_crl)
                   ^
838.               ok = ctx->get_crl(ctx, &crl, x);
839.           else

crypto/x509/x509_vfy.c:840:13: 
838.               ok = ctx->get_crl(ctx, &crl, x);
839.           else
840. >             ok = get_crl_delta(ctx, &crl, &dcrl, x);
841.           /*
842.            * If error looking up CRL, nothing we can do except notify callback

crypto/x509/x509_vfy.c:1389:1: start of procedure get_crl_delta()
  1387.    */
  1388.   
  1389. > static int get_crl_delta(X509_STORE_CTX *ctx,
  1390.                            X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
  1391.   {

crypto/x509/x509_vfy.c:1393:5: 
  1391.   {
  1392.       int ok;
  1393. >     X509 *issuer = NULL;
  1394.       int crl_score = 0;
  1395.       unsigned int reasons;

crypto/x509/x509_vfy.c:1394:5: 
  1392.       int ok;
  1393.       X509 *issuer = NULL;
  1394. >     int crl_score = 0;
  1395.       unsigned int reasons;
  1396.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:1396:5: 
  1394.       int crl_score = 0;
  1395.       unsigned int reasons;
  1396. >     X509_CRL *crl = NULL, *dcrl = NULL;
  1397.       STACK_OF(X509_CRL) *skcrl;
  1398.       X509_NAME *nm = X509_get_issuer_name(x);

crypto/x509/x509_vfy.c:1398:5: 
  1396.       X509_CRL *crl = NULL, *dcrl = NULL;
  1397.       STACK_OF(X509_CRL) *skcrl;
  1398. >     X509_NAME *nm = X509_get_issuer_name(x);
  1399.       reasons = ctx->current_reasons;
  1400.       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.   
