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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:341:2: 
  339.   {
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  341. > 	return st->data[i];
  342.   }
  343.   

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

crypto/x509/x509_vfy.c:1787:6: Taking false branch
1785.   	xi=sk_X509_value(ctx->chain,n);
1786.   
1787.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1788.   		xs=xi;
1789.   	else

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

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

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

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

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

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

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

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

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

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

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

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

crypto/x509/x509_vfy.c:1812:9: Loop condition is true. Entering loop body
1810.   
1811.   /*	ctx->error=0;  not needed */
1812.   	while (n >= 0)
                ^
1813.   		{
1814.   		ctx->error_depth=n;

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

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