crypto/x509/x509_vfy.c:410: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 408 could be null and is dereferenced at line 410, column 17.
Showing all 21 steps of the trace


crypto/x509/x509_vfy.c:370:1: start of procedure check_chain_extensions()
368.    */
369.   
370. > static int check_chain_extensions(X509_STORE_CTX *ctx)
371.   {
372.       int i, ok = 0, must_be_ca, plen = 0;

crypto/x509/x509_vfy.c:372:5: 
370.   static int check_chain_extensions(X509_STORE_CTX *ctx)
371.   {
372. >     int i, ok = 0, must_be_ca, plen = 0;
373.       X509 *x;
374.       int proxy_path_length = 0;

crypto/x509/x509_vfy.c:374:5: 
372.       int i, ok = 0, must_be_ca, plen = 0;
373.       X509 *x;
374. >     int proxy_path_length = 0;
375.       int purpose;
376.       int allow_proxy_certs;

crypto/x509/x509_vfy.c:387:5: 
385.        *     all certificates in the chain except the leaf certificate.
386.        */
387. >     must_be_ca = -1;
388.   
389.       /* CRL path validation */

crypto/x509/x509_vfy.c:390:9: Taking false branch
388.   
389.       /* CRL path validation */
390.       if (ctx->parent) {
               ^
391.           allow_proxy_certs = 0;
392.           purpose = X509_PURPOSE_CRL_SIGN;

crypto/x509/x509_vfy.c:395:17: Condition is true
393.       } else {
394.           allow_proxy_certs =
395.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
                       ^
396.           /*
397.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:395:13: 
393.       } else {
394.           allow_proxy_certs =
395. >             ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
396.           /*
397.            * A hack to keep people who don't want to modify their software

crypto/x509/x509_vfy.c:394:9: 
392.           purpose = X509_PURPOSE_CRL_SIGN;
393.       } else {
394. >         allow_proxy_certs =
395.               ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
396.           /*

crypto/x509/x509_vfy.c:400:13: Taking false branch
398.            * happy
399.            */
400.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
                   ^
401.               allow_proxy_certs = 1;
402.           purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:402:9: 
400.           if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
401.               allow_proxy_certs = 1;
402. >         purpose = ctx->param->purpose;
403.       }
404.   

crypto/x509/x509_vfy.c:406:10: 
404.   
405.       /* Check all untrusted certificates */
406. >     for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
407.           int ret;
408.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:406:17: Loop condition is true. Entering loop body
404.   
405.       /* Check all untrusted certificates */
406.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
                       ^
407.           int ret;
408.           x = sk_X509_value(ctx->chain, i);

crypto/x509/x509_vfy.c:408:9: 
406.       for (i = 0; i == 0 || i < ctx->num_untrusted; i++) {
407.           int ret;
408. >         x = sk_X509_value(ctx->chain, i);
409.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
410.               && (x->ex_flags & EXFLAG_CRITICAL)) {

include/openssl/x509.h:169:1: start of procedure sk_X509_value()
  167.   typedef struct x509_cinf_st X509_CINF;
  168.   
  169. > DEFINE_STACK_OF(X509)
  170.   
  171.   /* This is used for a table of trust checking functions */

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

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

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

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

include/openssl/x509.h:169:1: return from a call to sk_X509_value
  167.   typedef struct x509_cinf_st X509_CINF;
  168.   
  169. > DEFINE_STACK_OF(X509)
  170.   
  171.   /* This is used for a table of trust checking functions */

crypto/x509/x509_vfy.c:409:15: Taking true branch
407.           int ret;
408.           x = sk_X509_value(ctx->chain, i);
409.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
                     ^
410.               && (x->ex_flags & EXFLAG_CRITICAL)) {
411.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;

crypto/x509/x509_vfy.c:410:17: 
408.           x = sk_X509_value(ctx->chain, i);
409.           if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
410. >             && (x->ex_flags & EXFLAG_CRITICAL)) {
411.               ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
412.               ctx->error_depth = i;
