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


crypto/x509/x509_vfy.c:1771:1: start of procedure internal_verify()
1769.   	}
1770.   
1771. > static int internal_verify(X509_STORE_CTX *ctx)
1772.   	{
1773.   	int ok=0,n;

crypto/x509/x509_vfy.c:1773:2: 
1771.   static int internal_verify(X509_STORE_CTX *ctx)
1772.   	{
1773. > 	int ok=0,n;
1774.   	X509 *xs,*xi;
1775.   	EVP_PKEY *pkey=NULL;

crypto/x509/x509_vfy.c:1775:2: 
1773.   	int ok=0,n;
1774.   	X509 *xs,*xi;
1775. > 	EVP_PKEY *pkey=NULL;
1776.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1777.   

crypto/x509/x509_vfy.c:1778:2: 
1776.   	int (*cb)(int xok,X509_STORE_CTX *xctx);
1777.   
1778. > 	cb=ctx->verify_cb;
1779.   
1780.   	n=sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1780:4: Condition is true
1778.   	cb=ctx->verify_cb;
1779.   
1780.   	n=sk_X509_num(ctx->chain);
           ^
1781.   	ctx->error_depth=n-1;
1782.   	n--;

crypto/x509/x509_vfy.c:1780:2: 
1778.   	cb=ctx->verify_cb;
1779.   
1780. > 	n=sk_X509_num(ctx->chain);
1781.   	ctx->error_depth=n-1;
1782.   	n--;

crypto/stack/stack.c:331:1: start of procedure sk_num()
  329.   	}
  330.   
  331. > int sk_num(const _STACK *st)
  332.   {
  333.   	if(st == NULL) return -1;

crypto/stack/stack.c:333:5: Taking false branch
  331.   int sk_num(const _STACK *st)
  332.   {
  333.   	if(st == NULL) return -1;
             ^
  334.   	return st->num;
  335.   }

crypto/stack/stack.c:334:2: 
  332.   {
  333.   	if(st == NULL) return -1;
  334. > 	return st->num;
  335.   }
  336.   

crypto/stack/stack.c:335:1: return from a call to sk_num
  333.   	if(st == NULL) return -1;
  334.   	return st->num;
  335. > }
  336.   
  337.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:1781:2: 
1779.   
1780.   	n=sk_X509_num(ctx->chain);
1781. > 	ctx->error_depth=n-1;
1782.   	n--;
1783.   	xi=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1782:2: 
1780.   	n=sk_X509_num(ctx->chain);
1781.   	ctx->error_depth=n-1;
1782. > 	n--;
1783.   	xi=sk_X509_value(ctx->chain,n);
1784.   

crypto/x509/x509_vfy.c:1783:5: Condition is true
1781.   	ctx->error_depth=n-1;
1782.   	n--;
1783.   	xi=sk_X509_value(ctx->chain,n);
            ^
1784.   
1785.   	if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1783:2: 
1781.   	ctx->error_depth=n-1;
1782.   	n--;
1783. > 	xi=sk_X509_value(ctx->chain,n);
1784.   
1785.   	if (ctx->check_issued(ctx, xi, xi))

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 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:340:2: 
  338.   {
  339.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  340. > 	return st->data[i];
  341.   }
  342.   

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:1785:6: Taking false branch
1783.   	xi=sk_X509_value(ctx->chain,n);
1784.   
1785.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1786.   		xs=xi;
1787.   	else

crypto/x509/x509_vfy.c:1789:7: Taking false branch
1787.   	else
1788.   		{
1789.   		if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN)
              ^
1790.   			{
1791.   			xs = xi;

crypto/x509/x509_vfy.c:1794:7: Taking false branch
1792.   			goto check_cert;
1793.   			}
1794.   		if (n <= 0)
              ^
1795.   			{
1796.   			ctx->error=X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;

crypto/x509/x509_vfy.c:1803:4: 
1801.   		else
1802.   			{
1803. > 			n--;
1804.   			ctx->error_depth=n;
1805.   			xs=sk_X509_value(ctx->chain,n);

crypto/x509/x509_vfy.c:1804:4: 
1802.   			{
1803.   			n--;
1804. > 			ctx->error_depth=n;
1805.   			xs=sk_X509_value(ctx->chain,n);
1806.   			}

crypto/x509/x509_vfy.c:1805:7: Condition is true
1803.   			n--;
1804.   			ctx->error_depth=n;
1805.   			xs=sk_X509_value(ctx->chain,n);
              ^
1806.   			}
1807.   		}

crypto/x509/x509_vfy.c:1805:4: 
1803.   			n--;
1804.   			ctx->error_depth=n;
1805. > 			xs=sk_X509_value(ctx->chain,n);
1806.   			}
1807.   		}

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:1810:9: Loop condition is true. Entering loop body
1808.   
1809.   /*	ctx->error=0;  not needed */
1810.   	while (n >= 0)
                ^
1811.   		{
1812.   		ctx->error_depth=n;

crypto/x509/x509_vfy.c:1812:3: 
1810.   	while (n >= 0)
1811.   		{
1812. > 		ctx->error_depth=n;
1813.   
1814.   		/* Skip signature check for self signed certificates unless

crypto/x509/x509_vfy.c:1818:8: Taking false branch
1816.   		 * just wastes time.
1817.   		 */
1818.   		if (!xs->valid && (xs != xi || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE)))
               ^
1819.   			{
1820.   			if ((pkey=X509_get_pubkey(xi)) == NULL)
