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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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