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


crypto/x509/x509_vfy.c:828:1: start of procedure check_cert()
826.   }
827.   
828. > static int check_cert(X509_STORE_CTX *ctx)
829.   {
830.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:830:5: 
828.   static int check_cert(X509_STORE_CTX *ctx)
829.   {
830. >     X509_CRL *crl = NULL, *dcrl = NULL;
831.       X509 *x;
832.       int ok, cnum;

crypto/x509/x509_vfy.c:834:5: 
832.       int ok, cnum;
833.       unsigned int last_reasons;
834. >     cnum = ctx->error_depth;
835.       x = sk_X509_value(ctx->chain, cnum);
836.       ctx->current_cert = x;

crypto/x509/x509_vfy.c:835:9: Condition is true
833.       unsigned int last_reasons;
834.       cnum = ctx->error_depth;
835.       x = sk_X509_value(ctx->chain, cnum);
               ^
836.       ctx->current_cert = x;
837.       ctx->current_issuer = NULL;

crypto/x509/x509_vfy.c:835:5: 
833.       unsigned int last_reasons;
834.       cnum = ctx->error_depth;
835. >     x = sk_X509_value(ctx->chain, cnum);
836.       ctx->current_cert = x;
837.       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:836:5: 
834.       cnum = ctx->error_depth;
835.       x = sk_X509_value(ctx->chain, cnum);
836. >     ctx->current_cert = x;
837.       ctx->current_issuer = NULL;
838.       ctx->current_crl_score = 0;

crypto/x509/x509_vfy.c:837:5: 
835.       x = sk_X509_value(ctx->chain, cnum);
836.       ctx->current_cert = x;
837. >     ctx->current_issuer = NULL;
838.       ctx->current_crl_score = 0;
839.       ctx->current_reasons = 0;

crypto/x509/x509_vfy.c:838:5: 
836.       ctx->current_cert = x;
837.       ctx->current_issuer = NULL;
838. >     ctx->current_crl_score = 0;
839.       ctx->current_reasons = 0;
840.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {

crypto/x509/x509_vfy.c:839:5: 
837.       ctx->current_issuer = NULL;
838.       ctx->current_crl_score = 0;
839. >     ctx->current_reasons = 0;
840.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
841.           last_reasons = ctx->current_reasons;

crypto/x509/x509_vfy.c:840:12: Loop condition is true. Entering loop body
838.       ctx->current_crl_score = 0;
839.       ctx->current_reasons = 0;
840.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
                  ^
841.           last_reasons = ctx->current_reasons;
842.           /* Try to retrieve relevant CRL */

crypto/x509/x509_vfy.c:841:9: 
839.       ctx->current_reasons = 0;
840.       while (ctx->current_reasons != CRLDP_ALL_REASONS) {
841. >         last_reasons = ctx->current_reasons;
842.           /* Try to retrieve relevant CRL */
843.           if (ctx->get_crl)

crypto/x509/x509_vfy.c:843:13: Taking false branch
841.           last_reasons = ctx->current_reasons;
842.           /* Try to retrieve relevant CRL */
843.           if (ctx->get_crl)
                   ^
844.               ok = ctx->get_crl(ctx, &crl, x);
845.           else

crypto/x509/x509_vfy.c:846:13: 
844.               ok = ctx->get_crl(ctx, &crl, x);
845.           else
846. >             ok = get_crl_delta(ctx, &crl, &dcrl, x);
847.           /*
848.            * If error looking up CRL, nothing we can do except notify callback

crypto/x509/x509_vfy.c:1395:1: start of procedure get_crl_delta()
  1393.    */
  1394.   
  1395. > static int get_crl_delta(X509_STORE_CTX *ctx,
  1396.                            X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
  1397.   {

crypto/x509/x509_vfy.c:1399:5: 
  1397.   {
  1398.       int ok;
  1399. >     X509 *issuer = NULL;
  1400.       int crl_score = 0;
  1401.       unsigned int reasons;

crypto/x509/x509_vfy.c:1400:5: 
  1398.       int ok;
  1399.       X509 *issuer = NULL;
  1400. >     int crl_score = 0;
  1401.       unsigned int reasons;
  1402.       X509_CRL *crl = NULL, *dcrl = NULL;

crypto/x509/x509_vfy.c:1402:5: 
  1400.       int crl_score = 0;
  1401.       unsigned int reasons;
  1402. >     X509_CRL *crl = NULL, *dcrl = NULL;
  1403.       STACK_OF(X509_CRL) *skcrl;
  1404.       X509_NAME *nm = X509_get_issuer_name(x);

crypto/x509/x509_vfy.c:1404:5: 
  1402.       X509_CRL *crl = NULL, *dcrl = NULL;
  1403.       STACK_OF(X509_CRL) *skcrl;
  1404. >     X509_NAME *nm = X509_get_issuer_name(x);
  1405.       reasons = ctx->current_reasons;
  1406.       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.   
