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


crypto/x509/x509_vfy.c:1740:1: start of procedure internal_verify()
1738.   	}
1739.   
1740. > static int internal_verify(X509_STORE_CTX *ctx)
1741.   	{
1742.   	int ok=0,n;

crypto/x509/x509_vfy.c:1742:2: 
1740.   static int internal_verify(X509_STORE_CTX *ctx)
1741.   	{
1742. > 	int ok=0,n;
1743.   	X509 *xs,*xi;
1744.   	EVP_PKEY *pkey=NULL;

crypto/x509/x509_vfy.c:1744:2: 
1742.   	int ok=0,n;
1743.   	X509 *xs,*xi;
1744. > 	EVP_PKEY *pkey=NULL;
1745.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1746.   

crypto/x509/x509_vfy.c:1747:2: 
1745.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1746.   
1747. > 	cb=ctx->verify_cb;
1748.   
1749.   	n=sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1749:4: Condition is true
1747.   	cb=ctx->verify_cb;
1748.   
1749.   	n=sk_X509_num(ctx->chain);
           ^
1750.   	ctx->error_depth=n-1;
1751.   	n--;

crypto/x509/x509_vfy.c:1749:2: 
1747.   	cb=ctx->verify_cb;
1748.   
1749. > 	n=sk_X509_num(ctx->chain);
1750.   	ctx->error_depth=n-1;
1751.   	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:1750:2: 
1748.   
1749.   	n=sk_X509_num(ctx->chain);
1750. > 	ctx->error_depth=n-1;
1751.   	n--;
1752.   	xi=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1751:2: 
1749.   	n=sk_X509_num(ctx->chain);
1750.   	ctx->error_depth=n-1;
1751. > 	n--;
1752.   	xi=sk_X509_value(ctx->chain,n);
1753.   

crypto/x509/x509_vfy.c:1752:5: Condition is true
1750.   	ctx->error_depth=n-1;
1751.   	n--;
1752.   	xi=sk_X509_value(ctx->chain,n);
            ^
1753.   
1754.   	if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1752:2: 
1750.   	ctx->error_depth=n-1;
1751.   	n--;
1752. > 	xi=sk_X509_value(ctx->chain,n);
1753.   
1754.   	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:1754:6: Taking false branch
1752.   	xi=sk_X509_value(ctx->chain,n);
1753.   
1754.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1755.   		xs=xi;
1756.   	else

crypto/x509/x509_vfy.c:1758:7: Taking false branch
1756.   	else
1757.   		{
1758.   		if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN && n == 0)
              ^
1759.   			{
1760.   			xs = xi;

crypto/x509/x509_vfy.c:1763:7: Taking false branch
1761.   			goto check_cert;
1762.   			}
1763.   		if (n <= 0)
              ^
1764.   			{
1765.   			ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;

crypto/x509/x509_vfy.c:1772:4: 
1770.   		else
1771.   			{
1772. > 			n--;
1773.   			ctx->error_depth=n;
1774.   			xs=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1773:4: 
1771.   			{
1772.   			n--;
1773. > 			ctx->error_depth=n;
1774.   			xs=sk_X509_value(ctx->chain,n);
1775.   			}

crypto/x509/x509_vfy.c:1774:7: Condition is true
1772.   			n--;
1773.   			ctx->error_depth=n;
1774.   			xs=sk_X509_value(ctx->chain,n);
              ^
1775.   			}
1776.   		}

crypto/x509/x509_vfy.c:1774:4: 
1772.   			n--;
1773.   			ctx->error_depth=n;
1774. > 			xs=sk_X509_value(ctx->chain,n);
1775.   			}
1776.   		}

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:1779:9: Loop condition is true. Entering loop body
1777.   
1778.   /*	ctx->error=0;  not needed */
1779.   	while (n >= 0)
                ^
1780.   		{
1781.   		ctx->error_depth=n;

crypto/x509/x509_vfy.c:1781:3: 
1779.   	while (n >= 0)
1780.   		{
1781. > 		ctx->error_depth=n;
1782.   
1783.   		/* Skip signature check for self signed certificates unless

crypto/x509/x509_vfy.c:1787:8: Taking false branch
1785.   		 * just wastes time.
1786.   		 */
1787.   		if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)))
               ^
1788.   			{
1789.   			if ((pkey=X509_get_pubkey(xi)) == NULL)
