crypto/x509/x509_vfy.c:1668: error: NULL_DEREFERENCE
  pointer `xs` last assigned on line 1655 could be null and is dereferenced at line 1668, column 8.
Showing all 35 steps of the trace


crypto/x509/x509_vfy.c:1626:1: start of procedure internal_verify()
1624.   	}
1625.   
1626. > static int internal_verify(X509_STORE_CTX *ctx)
1627.   	{
1628.   	int ok=0,n;

crypto/x509/x509_vfy.c:1628:2: 
1626.   static int internal_verify(X509_STORE_CTX *ctx)
1627.   	{
1628. > 	int ok=0,n;
1629.   	X509 *xs,*xi;
1630.   	EVP_PKEY *pkey=NULL;

crypto/x509/x509_vfy.c:1630:2: 
1628.   	int ok=0,n;
1629.   	X509 *xs,*xi;
1630. > 	EVP_PKEY *pkey=NULL;
1631.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1632.   

crypto/x509/x509_vfy.c:1633:2: 
1631.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1632.   
1633. > 	cb=ctx->verify_cb;
1634.   
1635.   	n=sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1635:4: Condition is true
1633.   	cb=ctx->verify_cb;
1634.   
1635.   	n=sk_X509_num(ctx->chain);
           ^
1636.   	ctx->error_depth=n-1;
1637.   	n--;

crypto/x509/x509_vfy.c:1635:2: 
1633.   	cb=ctx->verify_cb;
1634.   
1635. > 	n=sk_X509_num(ctx->chain);
1636.   	ctx->error_depth=n-1;
1637.   	n--;

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:1636:2: 
1634.   
1635.   	n=sk_X509_num(ctx->chain);
1636. > 	ctx->error_depth=n-1;
1637.   	n--;
1638.   	xi=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1637:2: 
1635.   	n=sk_X509_num(ctx->chain);
1636.   	ctx->error_depth=n-1;
1637. > 	n--;
1638.   	xi=sk_X509_value(ctx->chain,n);
1639.   

crypto/x509/x509_vfy.c:1638:5: Condition is true
1636.   	ctx->error_depth=n-1;
1637.   	n--;
1638.   	xi=sk_X509_value(ctx->chain,n);
            ^
1639.   
1640.   	if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1638:2: 
1636.   	ctx->error_depth=n-1;
1637.   	n--;
1638. > 	xi=sk_X509_value(ctx->chain,n);
1639.   
1640.   	if (ctx->check_issued(ctx, xi, xi))

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 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:303:2: 
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303. > 	return st->data[i];
  304.   }
  305.   

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:1640:6: Taking false branch
1638.   	xi=sk_X509_value(ctx->chain,n);
1639.   
1640.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1641.   		xs=xi;
1642.   	else

crypto/x509/x509_vfy.c:1644:7: Taking false branch
1642.   	else
1643.   		{
1644.   		if (n <= 0)
              ^
1645.   			{
1646.   			ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;

crypto/x509/x509_vfy.c:1653:4: 
1651.   		else
1652.   			{
1653. > 			n--;
1654.   			ctx->error_depth=n;
1655.   			xs=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1654:4: 
1652.   			{
1653.   			n--;
1654. > 			ctx->error_depth=n;
1655.   			xs=sk_X509_value(ctx->chain,n);
1656.   			}

crypto/x509/x509_vfy.c:1655:7: Condition is true
1653.   			n--;
1654.   			ctx->error_depth=n;
1655.   			xs=sk_X509_value(ctx->chain,n);
              ^
1656.   			}
1657.   		}

crypto/x509/x509_vfy.c:1655:4: 
1653.   			n--;
1654.   			ctx->error_depth=n;
1655. > 			xs=sk_X509_value(ctx->chain,n);
1656.   			}
1657.   		}

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:1660:9: Loop condition is true. Entering loop body
1658.   
1659.   /*	ctx->error=0;  not needed */
1660.   	while (n >= 0)
                ^
1661.   		{
1662.   		ctx->error_depth=n;

crypto/x509/x509_vfy.c:1662:3: 
1660.   	while (n >= 0)
1661.   		{
1662. > 		ctx->error_depth=n;
1663.   
1664.   		/* Skip signature check for self signed certificates unless

crypto/x509/x509_vfy.c:1668:8: Taking false branch
1666.   		 * just wastes time.
1667.   		 */
1668.   		if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)))
               ^
1669.   			{
1670.   			if ((pkey=X509_get_pubkey(xi)) == NULL)
