crypto/x509/x509_vfy.c:1235: error: NULL_DEREFERENCE
  pointer `crl_issuer` last assigned on line 1234 could be null and is dereferenced by call to `X509_get_subject_name()` at line 1235, column 27.
Showing all 52 steps of the trace


crypto/x509/x509_vfy.c:1212:1: start of procedure crl_akid_check()
1210.   }
1211.   
1212. > static void crl_akid_check(X509_STORE_CTX *ctx, X509_CRL *crl,
1213.                              X509 **pissuer, int *pcrl_score)
1214.   {

crypto/x509/x509_vfy.c:1215:5: 
1213.                              X509 **pissuer, int *pcrl_score)
1214.   {
1215. >     X509 *crl_issuer = NULL;
1216.       X509_NAME *cnm = X509_CRL_get_issuer(crl);
1217.       int cidx = ctx->error_depth;

crypto/x509/x509_vfy.c:1216:5: 
1214.   {
1215.       X509 *crl_issuer = NULL;
1216. >     X509_NAME *cnm = X509_CRL_get_issuer(crl);
1217.       int cidx = ctx->error_depth;
1218.       int i;

crypto/x509/x509cset.c:106:1: start of procedure X509_CRL_get_issuer()
  104.   #endif
  105.   
  106. > X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl)
  107.   {
  108.       return crl->crl.issuer;

crypto/x509/x509cset.c:108:5: 
  106.   X509_NAME *X509_CRL_get_issuer(const X509_CRL *crl)
  107.   {
  108. >     return crl->crl.issuer;
  109.   }
  110.   

crypto/x509/x509cset.c:109:1: return from a call to X509_CRL_get_issuer
  107.   {
  108.       return crl->crl.issuer;
  109. > }
  110.   
  111.   const STACK_OF(X509_EXTENSION) *X509_CRL_get0_extensions(const X509_CRL *crl)

crypto/x509/x509_vfy.c:1217:5: 
1215.       X509 *crl_issuer = NULL;
1216.       X509_NAME *cnm = X509_CRL_get_issuer(crl);
1217. >     int cidx = ctx->error_depth;
1218.       int i;
1219.   

crypto/x509/x509_vfy.c:1220:9: 
1218.       int i;
1219.   
1220. >     if (cidx != sk_X509_num(ctx->chain) - 1)
1221.           cidx++;
1222.   

include/openssl/x509.h:99:1: start of procedure sk_X509_num()
  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:375:1: start of procedure OPENSSL_sk_num()
    373.   }
    374.   
    375. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377.       return st == NULL ? -1 : st->num;

crypto/stack/stack.c:377:12: Condition is true
    375.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377.       return st == NULL ? -1 : st->num;
                      ^
    378.   }
    379.   

crypto/stack/stack.c:377:5: 
    375.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377. >     return st == NULL ? -1 : st->num;
    378.   }
    379.   

crypto/stack/stack.c:378:1: return from a call to OPENSSL_sk_num
    376.   {
    377.       return st == NULL ? -1 : st->num;
    378. > }
    379.   
    380.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)

include/openssl/x509.h:99:1: return from a call to sk_X509_num
  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:1220:9: Taking true branch
1218.       int i;
1219.   
1220.       if (cidx != sk_X509_num(ctx->chain) - 1)
                ^
1221.           cidx++;
1222.   

crypto/x509/x509_vfy.c:1221:9: 
1219.   
1220.       if (cidx != sk_X509_num(ctx->chain) - 1)
1221. >         cidx++;
1222.   
1223.       crl_issuer = sk_X509_value(ctx->chain, cidx);

crypto/x509/x509_vfy.c:1223:5: 
1221.           cidx++;
1222.   
1223. >     crl_issuer = sk_X509_value(ctx->chain, cidx);
1224.   
1225.       if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) {

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:380:1: start of procedure OPENSSL_sk_value()
    378.   }
    379.   
    380. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    381.   {
    382.       if (i < 0 || i >= st->num)

crypto/stack/stack.c:382:9: Taking true branch
    380.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    381.   {
    382.       if (i < 0 || i >= st->num)
                   ^
    383.           return NULL;
    384.       return (void *)st->data[i];

crypto/stack/stack.c:383:9: 
    381.   {
    382.       if (i < 0 || i >= st->num)
    383. >         return NULL;
    384.       return (void *)st->data[i];
    385.   }

crypto/stack/stack.c:385:1: return from a call to OPENSSL_sk_value
    383.           return NULL;
    384.       return (void *)st->data[i];
    385. > }
    386.   
    387.   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:1225:9: 
1223.       crl_issuer = sk_X509_value(ctx->chain, cidx);
1224.   
1225. >     if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) {
1226.           if (*pcrl_score & CRL_SCORE_ISSUER_NAME) {
1227.               *pcrl_score |= CRL_SCORE_AKID | CRL_SCORE_ISSUER_CERT;

crypto/x509v3/v3_purp.c:785:1: start of procedure X509_check_akid()
  783.   }
  784.   
  785. > int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid)
  786.   {
  787.   

crypto/x509v3/v3_purp.c:788:10: Taking false branch
  786.   {
  787.   
  788.       if (!akid)
                  ^
  789.           return X509_V_OK;
  790.   

crypto/x509v3/v3_purp.c:792:9: Taking false branch
  790.   
  791.       /* Check key ids (if present) */
  792.       if (akid->keyid && issuer->skid &&
                 ^
  793.           ASN1_OCTET_STRING_cmp(akid->keyid, issuer->skid))
  794.           return X509_V_ERR_AKID_SKID_MISMATCH;

crypto/x509v3/v3_purp.c:796:9: Taking false branch
  794.           return X509_V_ERR_AKID_SKID_MISMATCH;
  795.       /* Check serial number */
  796.       if (akid->serial &&
                 ^
  797.           ASN1_INTEGER_cmp(X509_get_serialNumber(issuer), akid->serial))
  798.           return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;

crypto/x509v3/v3_purp.c:800:9: Taking false branch
  798.           return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
  799.       /* Check issuer name */
  800.       if (akid->issuer) {
                 ^
  801.           /*
  802.            * Ugh, for some peculiar reason AKID includes SEQUENCE OF

crypto/x509v3/v3_purp.c:821:5: 
  819.               return X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH;
  820.       }
  821. >     return X509_V_OK;
  822.   }
  823.   

crypto/x509v3/v3_purp.c:822:1: return from a call to X509_check_akid
  820.       }
  821.       return X509_V_OK;
  822. > }
  823.   
  824.   uint32_t X509_get_extension_flags(X509 *x)

crypto/x509/x509_vfy.c:1225:9: Taking true branch
1223.       crl_issuer = sk_X509_value(ctx->chain, cidx);
1224.   
1225.       if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) {
                ^
1226.           if (*pcrl_score & CRL_SCORE_ISSUER_NAME) {
1227.               *pcrl_score |= CRL_SCORE_AKID | CRL_SCORE_ISSUER_CERT;

crypto/x509/x509_vfy.c:1226:13: Taking false branch
1224.   
1225.       if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) {
1226.           if (*pcrl_score & CRL_SCORE_ISSUER_NAME) {
                    ^
1227.               *pcrl_score |= CRL_SCORE_AKID | CRL_SCORE_ISSUER_CERT;
1228.               *pissuer = crl_issuer;

crypto/x509/x509_vfy.c:1233:10: 
1231.       }
1232.   
1233. >     for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) {
1234.           crl_issuer = sk_X509_value(ctx->chain, cidx);
1235.           if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))

crypto/x509/x509_vfy.c:1233:18: 
1231.       }
1232.   
1233. >     for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) {
1234.           crl_issuer = sk_X509_value(ctx->chain, cidx);
1235.           if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))

include/openssl/x509.h:99:1: start of procedure sk_X509_num()
  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:375:1: start of procedure OPENSSL_sk_num()
    373.   }
    374.   
    375. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377.       return st == NULL ? -1 : st->num;

crypto/stack/stack.c:377:12: Condition is true
    375.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377.       return st == NULL ? -1 : st->num;
                      ^
    378.   }
    379.   

crypto/stack/stack.c:377:5: 
    375.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    376.   {
    377. >     return st == NULL ? -1 : st->num;
    378.   }
    379.   

crypto/stack/stack.c:378:1: return from a call to OPENSSL_sk_num
    376.   {
    377.       return st == NULL ? -1 : st->num;
    378. > }
    379.   
    380.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)

include/openssl/x509.h:99:1: return from a call to sk_X509_num
  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:1233:18: Loop condition is true. Entering loop body
1231.       }
1232.   
1233.       for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) {
                         ^
1234.           crl_issuer = sk_X509_value(ctx->chain, cidx);
1235.           if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))

crypto/x509/x509_vfy.c:1234:9: 
1232.   
1233.       for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) {
1234. >         crl_issuer = sk_X509_value(ctx->chain, cidx);
1235.           if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))
1236.               continue;

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:380:1: start of procedure OPENSSL_sk_value()
    378.   }
    379.   
    380. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    381.   {
    382.       if (i < 0 || i >= st->num)

crypto/stack/stack.c:382:9: Taking true branch
    380.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    381.   {
    382.       if (i < 0 || i >= st->num)
                   ^
    383.           return NULL;
    384.       return (void *)st->data[i];

crypto/stack/stack.c:383:9: 
    381.   {
    382.       if (i < 0 || i >= st->num)
    383. >         return NULL;
    384.       return (void *)st->data[i];
    385.   }

crypto/stack/stack.c:385:1: return from a call to OPENSSL_sk_value
    383.           return NULL;
    384.       return (void *)st->data[i];
    385. > }
    386.   
    387.   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:1235:13: 
1233.       for (cidx++; cidx < sk_X509_num(ctx->chain); cidx++) {
1234.           crl_issuer = sk_X509_value(ctx->chain, cidx);
1235. >         if (X509_NAME_cmp(X509_get_subject_name(crl_issuer), cnm))
1236.               continue;
1237.           if (X509_check_akid(crl_issuer, crl->akid) == X509_V_OK) {

crypto/x509/x509_cmp.c:99:1: start of procedure X509_get_subject_name()
  97.   #endif
  98.   
  99. > X509_NAME *X509_get_subject_name(const X509 *a)
  100.   {
  101.       return a->cert_info.subject;

crypto/x509/x509_cmp.c:101:5: 
  99.   X509_NAME *X509_get_subject_name(const X509 *a)
  100.   {
  101. >     return a->cert_info.subject;
  102.   }
  103.   
