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


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

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

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

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

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

crypto/x509/x509_vfy.c:1632:2: 
1630.   	cb=ctx->verify_cb;
1631.   
1632. > 	n=sk_X509_num(ctx->chain);
1633.   	ctx->error_depth=n-1;
1634.   	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:1633:2: 
1631.   
1632.   	n=sk_X509_num(ctx->chain);
1633. > 	ctx->error_depth=n-1;
1634.   	n--;
1635.   	xi=sk_X509_value(ctx->chain,n);

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

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

crypto/x509/x509_vfy.c:1635:2: 
1633.   	ctx->error_depth=n-1;
1634.   	n--;
1635. > 	xi=sk_X509_value(ctx->chain,n);
1636.   
1637.   	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:1637:6: Taking false branch
1635.   	xi=sk_X509_value(ctx->chain,n);
1636.   
1637.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1638.   		xs=xi;
1639.   	else

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

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

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

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

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

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

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

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