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


crypto/x509/x509_vfy.c:1708:1: start of procedure internal_verify()
1706.   }
1707.   
1708. > static int internal_verify(X509_STORE_CTX *ctx)
1709.   {
1710.       int ok = 0, n;

crypto/x509/x509_vfy.c:1710:5: 
1708.   static int internal_verify(X509_STORE_CTX *ctx)
1709.   {
1710. >     int ok = 0, n;
1711.       X509 *xs, *xi;
1712.       EVP_PKEY *pkey = NULL;

crypto/x509/x509_vfy.c:1712:5: 
1710.       int ok = 0, n;
1711.       X509 *xs, *xi;
1712. >     EVP_PKEY *pkey = NULL;
1713.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1714.   

crypto/x509/x509_vfy.c:1715:5: 
1713.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1714.   
1715. >     cb = ctx->verify_cb;
1716.   
1717.       n = sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1717:9: Condition is true
1715.       cb = ctx->verify_cb;
1716.   
1717.       n = sk_X509_num(ctx->chain);
                ^
1718.       ctx->error_depth = n - 1;
1719.       n--;

crypto/x509/x509_vfy.c:1717:5: 
1715.       cb = ctx->verify_cb;
1716.   
1717. >     n = sk_X509_num(ctx->chain);
1718.       ctx->error_depth = n - 1;
1719.       n--;

crypto/stack/stack.c:319:1: start of procedure sk_num()
  317.   }
  318.   
  319. > int sk_num(const _STACK *st)
  320.   {
  321.       if (st == NULL)

crypto/stack/stack.c:321:9: Taking false branch
  319.   int sk_num(const _STACK *st)
  320.   {
  321.       if (st == NULL)
                 ^
  322.           return -1;
  323.       return st->num;

crypto/stack/stack.c:323:5: 
  321.       if (st == NULL)
  322.           return -1;
  323. >     return st->num;
  324.   }
  325.   

crypto/stack/stack.c:324:1: return from a call to sk_num
  322.           return -1;
  323.       return st->num;
  324. > }
  325.   
  326.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:1718:5: 
1716.   
1717.       n = sk_X509_num(ctx->chain);
1718. >     ctx->error_depth = n - 1;
1719.       n--;
1720.       xi = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1719:5: 
1717.       n = sk_X509_num(ctx->chain);
1718.       ctx->error_depth = n - 1;
1719. >     n--;
1720.       xi = sk_X509_value(ctx->chain, n);
1721.   

crypto/x509/x509_vfy.c:1720:10: Condition is true
1718.       ctx->error_depth = n - 1;
1719.       n--;
1720.       xi = sk_X509_value(ctx->chain, n);
                 ^
1721.   
1722.       if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1720:5: 
1718.       ctx->error_depth = n - 1;
1719.       n--;
1720. >     xi = sk_X509_value(ctx->chain, n);
1721.   
1722.       if (ctx->check_issued(ctx, xi, xi))

crypto/stack/stack.c:326:1: start of procedure sk_value()
  324.   }
  325.   
  326. > void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:328:10: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                  ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:17: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                         ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:28: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:330:5: 
  328.       if (!st || (i < 0) || (i >= st->num))
  329.           return NULL;
  330. >     return st->data[i];
  331.   }
  332.   

crypto/stack/stack.c:331:1: return from a call to sk_value
  329.           return NULL;
  330.       return st->data[i];
  331. > }
  332.   
  333.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1722:9: Taking false branch
1720.       xi = sk_X509_value(ctx->chain, n);
1721.   
1722.       if (ctx->check_issued(ctx, xi, xi))
                ^
1723.           xs = xi;
1724.       else {

crypto/x509/x509_vfy.c:1725:13: Taking false branch
1723.           xs = xi;
1724.       else {
1725.           if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) {
                    ^
1726.               xs = xi;
1727.               goto check_cert;

crypto/x509/x509_vfy.c:1729:13: Taking false branch
1727.               goto check_cert;
1728.           }
1729.           if (n <= 0) {
                    ^
1730.               ctx->error = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
1731.               ctx->current_cert = xi;

crypto/x509/x509_vfy.c:1735:13: 
1733.               goto end;
1734.           } else {
1735. >             n--;
1736.               ctx->error_depth = n;
1737.               xs = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1736:13: 
1734.           } else {
1735.               n--;
1736. >             ctx->error_depth = n;
1737.               xs = sk_X509_value(ctx->chain, n);
1738.           }

crypto/x509/x509_vfy.c:1737:18: Condition is true
1735.               n--;
1736.               ctx->error_depth = n;
1737.               xs = sk_X509_value(ctx->chain, n);
                         ^
1738.           }
1739.       }

crypto/x509/x509_vfy.c:1737:13: 
1735.               n--;
1736.               ctx->error_depth = n;
1737. >             xs = sk_X509_value(ctx->chain, n);
1738.           }
1739.       }

crypto/stack/stack.c:326:1: start of procedure sk_value()
  324.   }
  325.   
  326. > void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:328:10: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                  ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:17: Taking false branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                         ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:328:28: Taking true branch
  326.   void *sk_value(const _STACK *st, int i)
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  329.           return NULL;
  330.       return st->data[i];

crypto/stack/stack.c:329:9: 
  327.   {
  328.       if (!st || (i < 0) || (i >= st->num))
  329. >         return NULL;
  330.       return st->data[i];
  331.   }

crypto/stack/stack.c:331:1: return from a call to sk_value
  329.           return NULL;
  330.       return st->data[i];
  331. > }
  332.   
  333.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1742:12: Loop condition is true. Entering loop body
1740.   
1741.   /*      ctx->error=0;  not needed */
1742.       while (n >= 0) {
                   ^
1743.           ctx->error_depth = n;
1744.   

crypto/x509/x509_vfy.c:1743:9: 
1741.   /*      ctx->error=0;  not needed */
1742.       while (n >= 0) {
1743. >         ctx->error_depth = n;
1744.   
1745.           /*

crypto/x509/x509_vfy.c:1750:14: Taking false branch
1748.            * time.
1749.            */
1750.           if (!xs->valid
                     ^
1751.               && (xs != xi
1752.                   || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) {
