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


crypto/x509/x509_vfy.c:545:1: start of procedure check_chain_extensions()
543.    */
544.   
545. > static int check_chain_extensions(X509_STORE_CTX *ctx)
546.   {
547.   #ifdef OPENSSL_NO_CHAIN_VERIFY

crypto/x509/x509_vfy.c:550:2: 
548.   	return 1;
549.   #else
550. > 	int i, ok=0, must_be_ca, plen = 0;
551.   	X509 *x;
552.   	int (*cb)(int xok,X509_STORE_CTX *xctx);

crypto/x509/x509_vfy.c:553:2: 
551.   	X509 *x;
552.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
553. > 	int proxy_path_length = 0;
554.   	int purpose;
555.   	int allow_proxy_certs;

crypto/x509/x509_vfy.c:556:2: 
554.   	int purpose;
555.   	int allow_proxy_certs;
556. > 	cb=ctx->verify_cb;
557.   
558.   	/* must_be_ca can have 1 of 3 values:

crypto/x509/x509_vfy.c:566:2: 
564.   	       all certificates in the chain except the leaf certificate.
565.   	*/
566. > 	must_be_ca = -1;
567.   
568.   	/* CRL path validation */

crypto/x509/x509_vfy.c:569:6: Taking false branch
567.   
568.   	/* CRL path validation */
569.   	if (ctx->parent)
            ^
570.   		{
571.   		allow_proxy_certs = 0;

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

crypto/x509/x509_vfy.c:577:4: 
575.   		{
576.   		allow_proxy_certs =
577. > 			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
578.   		/* A hack to keep people who don't want to modify their
579.   		   software happy */

crypto/x509/x509_vfy.c:576:3: 
574.   	else
575.   		{
576. > 		allow_proxy_certs =
577.   			!!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS);
578.   		/* A hack to keep people who don't want to modify their

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

crypto/x509/x509_vfy.c:582:3: 
580.   		if (getenv("OPENSSL_ALLOW_PROXY_CERTS"))
581.   			allow_proxy_certs = 1;
582. > 		purpose = ctx->param->purpose;
583.   		}
584.   

crypto/x509/x509_vfy.c:586:7: 
584.   
585.   	/* Check all untrusted certificates */
586. > 	for (i = 0; i < ctx->last_untrusted; i++)
587.   		{
588.   		int ret;

crypto/x509/x509_vfy.c:586:14: Loop condition is true. Entering loop body
584.   
585.   	/* Check all untrusted certificates */
586.   	for (i = 0; i < ctx->last_untrusted; i++)
                    ^
587.   		{
588.   		int ret;

crypto/x509/x509_vfy.c:589:7: Condition is true
587.   		{
588.   		int ret;
589.   		x = sk_X509_value(ctx->chain, i);
             ^
590.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
591.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/x509/x509_vfy.c:589:3: 
587.   		{
588.   		int ret;
589. > 		x = sk_X509_value(ctx->chain, i);
590.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
591.   			&& (x->ex_flags & EXFLAG_CRITICAL))

crypto/stack/stack.c:337:1: start of procedure sk_value()
  335.   }
  336.   
  337. > void *sk_value(const _STACK *st, int i)
  338.   {
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:339:6: Taking false branch
  337.   void *sk_value(const _STACK *st, int i)
  338.   {
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  340.   	return st->data[i];
  341.   }

crypto/stack/stack.c:339:13: Taking false branch
  337.   void *sk_value(const _STACK *st, int i)
  338.   {
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  340.   	return st->data[i];
  341.   }

crypto/stack/stack.c:339:24: Taking true branch
  337.   void *sk_value(const _STACK *st, int i)
  338.   {
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  340.   	return st->data[i];
  341.   }

crypto/stack/stack.c:339:39: 
  337.   void *sk_value(const _STACK *st, int i)
  338.   {
  339. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  340.   	return st->data[i];
  341.   }

crypto/stack/stack.c:341:1: return from a call to sk_value
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  340.   	return st->data[i];
  341. > }
  342.   
  343.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:590:9: Taking true branch
588.   		int ret;
589.   		x = sk_X509_value(ctx->chain, i);
590.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
               ^
591.   			&& (x->ex_flags & EXFLAG_CRITICAL))
592.   			{

crypto/x509/x509_vfy.c:591:8: 
589.   		x = sk_X509_value(ctx->chain, i);
590.   		if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL)
591. > 			&& (x->ex_flags & EXFLAG_CRITICAL))
592.   			{
593.   			ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
