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


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

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

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

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

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

crypto/x509/x509_vfy.c:1781:2: 
1779.   	cb=ctx->verify_cb;
1780.   
1781. > 	n=sk_X509_num(ctx->chain);
1782.   	ctx->error_depth=n-1;
1783.   	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:1782:2: 
1780.   
1781.   	n=sk_X509_num(ctx->chain);
1782. > 	ctx->error_depth=n-1;
1783.   	n--;
1784.   	xi=sk_X509_value(ctx->chain,n);

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

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

crypto/x509/x509_vfy.c:1784:2: 
1782.   	ctx->error_depth=n-1;
1783.   	n--;
1784. > 	xi=sk_X509_value(ctx->chain,n);
1785.   
1786.   	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:1786:6: Taking false branch
1784.   	xi=sk_X509_value(ctx->chain,n);
1785.   
1786.   	if (ctx->check_issued(ctx, xi, xi))
             ^
1787.   		xs=xi;
1788.   	else

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

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

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

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

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

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

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

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

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