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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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