crypto/x509/x509_vfy.c:508: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 498 could be null and is dereferenced at line 508, column 30.
Showing all 24 steps of the trace


crypto/x509/x509_vfy.c:454:1: start of procedure check_chain_extensions()
452.    */
453.   
454. > static int check_chain_extensions(X509_STORE_CTX *ctx)
455.   {
456.   #ifdef OPENSSL_NO_CHAIN_VERIFY

crypto/x509/x509_vfy.c:459:2: 
457.   	return 1;
458.   #else
459. > 	int i, ok=0, must_be_ca, plen = 0;
460.   	X509 *x;
461.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:462:2: 
460.   	X509 *x;
461.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
462. > 	int proxy_path_length = 0;
463.   	int purpose;
464.   	int allow_proxy_certs;

crypto/x509/x509_vfy.c:465:2: 
463.   	int purpose;
464.   	int allow_proxy_certs;
465. > 	cb=ctx->verify_cb;
466.   
467.   	/* must_be_ca can have 1 of 3 values:

crypto/x509/x509_vfy.c:475:2: 
473.   	       all certificates in the chain except the leaf certificate.
474.   	*/
475. > 	must_be_ca = -1;
476.   
477.   	/* CRL path validation */

crypto/x509/x509_vfy.c:478:6: Taking false branch
476.   
477.   	/* CRL path validation */
478.   	if (ctx->parent)
            ^
479.   		{
480.   		allow_proxy_certs = 0;

crypto/x509/x509_vfy.c:486:7: Condition is true
484.   		{
485.   		allow_proxy_certs =
486.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
             ^
487.   		/* A hack to keep people who don't want to modify their
488.   		   software happy */

crypto/x509/x509_vfy.c:486:4: 
484.   		{
485.   		allow_proxy_certs =
486. > 			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
487.   		/* A hack to keep people who don't want to modify their
488.   		   software happy */

crypto/x509/x509_vfy.c:485:3: 
483.   	else
484.   		{
485. > 		allow_proxy_certs =
486.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
487.   		/* A hack to keep people who don't want to modify their

crypto/x509/x509_vfy.c:489:7: Taking false branch
487.   		/* A hack to keep people who don't want to modify their
488.   		   software happy */
489.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
             ^
490.   			allow_proxy_certs = 1;
491.   		purpose = ctx->param->purpose;

crypto/x509/x509_vfy.c:491:3: 
489.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
490.   			allow_proxy_certs = 1;
491. > 		purpose = ctx->param->purpose;
492.   		}
493.   

crypto/x509/x509_vfy.c:495:7: 
493.   
494.   	/* Check all untrusted certificates */
495. > 	for (i = 0; i < ctx->last_untrusted; i++)
496.   		{
497.   		int ret;

crypto/x509/x509_vfy.c:495:14: Loop condition is true. Entering loop body
493.   
494.   	/* Check all untrusted certificates */
495.   	for (i = 0; i < ctx->last_untrusted; i++)
                    ^
496.   		{
497.   		int ret;

crypto/x509/x509_vfy.c:498:7: Condition is true
496.   		{
497.   		int ret;
498.   		x = sk_X509_value(ctx->chain, i);
             ^
499.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
500.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/x509/x509_vfy.c:498:3: 
496.   		{
497.   		int ret;
498. > 		x = sk_X509_value(ctx->chain, i);
499.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
500.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/stack/stack.c:308:1: start of procedure sk_value()
  306.   }
  307.   
  308. > void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:310:6: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:13: Taking false branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:24: Taking true branch
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:310:39: 
  308.   void *sk_value(const _STACK *st, int i)
  309.   {
  310. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312.   }

crypto/stack/stack.c:312:1: return from a call to sk_value
  310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  311.   	return st->data[i];
  312. > }
  313.   
  314.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:499:9: Taking false branch
497.   		int ret;
498.   		x = sk_X509_value(ctx->chain, i);
499.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
               ^
500.   			&& (x->ex_flags & EXFLAG_CRITICAL))
501.   			{

crypto/x509/x509_vfy.c:508:8: Taking true branch
506.   			if (!ok) goto end;
507.   			}
508.   		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
              ^
509.   			{
510.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;

crypto/x509/x509_vfy.c:508:30: 
506.   			if (!ok) goto end;
507.   			}
508. > 		if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY))
509.   			{
510.   			ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED;
