crypto/x509/x509_vfy.c:520: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 518 could be null and is dereferenced at line 520, column 8.
Showing all 23 steps of the trace


crypto/x509/x509_vfy.c:474:1: start of procedure check_chain_extensions()
472.    */
473.   
474. > static int check_chain_extensions(X509_STORE_CTX *ctx)
475.   {
476.   #ifdef OPENSSL_NO_CHAIN_VERIFY

crypto/x509/x509_vfy.c:479:2: 
477.   	return 1;
478.   #else
479. > 	int i, ok=0, must_be_ca, plen = 0;
480.   	X509 *x;
481.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:482:2: 
480.   	X509 *x;
481.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
482. > 	int proxy_path_length = 0;
483.   	int purpose;
484.   	int allow_proxy_certs;

crypto/x509/x509_vfy.c:485:2: 
483.   	int purpose;
484.   	int allow_proxy_certs;
485. > 	cb=ctx->verify_cb;
486.   
487.   	/* must_be_ca can have 1 of 3 values:

crypto/x509/x509_vfy.c:495:2: 
493.   	       all certificates in the chain except the leaf certificate.
494.   	*/
495. > 	must_be_ca = -1;
496.   
497.   	/* CRL path validation */

crypto/x509/x509_vfy.c:498:6: Taking false branch
496.   
497.   	/* CRL path validation */
498.   	if (ctx->parent)
            ^
499.   		{
500.   		allow_proxy_certs = 0;

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

crypto/x509/x509_vfy.c:506:4: 
504.   		{
505.   		allow_proxy_certs =
506. > 			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
507.   		/* A hack to keep people who don't want to modify their
508.   		   software happy */

crypto/x509/x509_vfy.c:505:3: 
503.   	else
504.   		{
505. > 		allow_proxy_certs =
506.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
507.   		/* A hack to keep people who don't want to modify their

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

crypto/x509/x509_vfy.c:511:3: 
509.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
510.   			allow_proxy_certs = 1;
511. > 		purpose = ctx->param->purpose;
512.   		}
513.   

crypto/x509/x509_vfy.c:515:7: 
513.   
514.   	/* Check all untrusted certificates */
515. > 	for (i = 0; i < ctx->last_untrusted; i++)
516.   		{
517.   		int ret;

crypto/x509/x509_vfy.c:515:14: Loop condition is true. Entering loop body
513.   
514.   	/* Check all untrusted certificates */
515.   	for (i = 0; i < ctx->last_untrusted; i++)
                    ^
516.   		{
517.   		int ret;

crypto/x509/x509_vfy.c:518:7: Condition is true
516.   		{
517.   		int ret;
518.   		x = sk_X509_value(ctx->chain, i);
             ^
519.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
520.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/x509/x509_vfy.c:518:3: 
516.   		{
517.   		int ret;
518. > 		x = sk_X509_value(ctx->chain, i);
519.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
520.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:24: Taking true branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:39: 
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:519:9: Taking true branch
517.   		int ret;
518.   		x = sk_X509_value(ctx->chain, i);
519.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
               ^
520.   			&& (x->ex_flags & EXFLAG_CRITICAL))
521.   			{

crypto/x509/x509_vfy.c:520:8: 
518.   		x = sk_X509_value(ctx->chain, i);
519.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
520. > 			&& (x->ex_flags & EXFLAG_CRITICAL))
521.   			{
522.   			ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
