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


crypto/x509/x509_vfy.c:1677:1: start of procedure internal_verify()
1675.   }
1676.   
1677. > static int internal_verify(X509_STORE_CTX *ctx)
1678.   {
1679.       int ok = 0, n;

crypto/x509/x509_vfy.c:1679:5: 
1677.   static int internal_verify(X509_STORE_CTX *ctx)
1678.   {
1679. >     int ok = 0, n;
1680.       X509 *xs, *xi;
1681.       EVP_PKEY *pkey = NULL;

crypto/x509/x509_vfy.c:1681:5: 
1679.       int ok = 0, n;
1680.       X509 *xs, *xi;
1681. >     EVP_PKEY *pkey = NULL;
1682.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1683.   

crypto/x509/x509_vfy.c:1684:5: 
1682.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1683.   
1684. >     cb = ctx->verify_cb;
1685.   
1686.       n = sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1686:9: Condition is true
1684.       cb = ctx->verify_cb;
1685.   
1686.       n = sk_X509_num(ctx->chain);
                ^
1687.       ctx->error_depth = n - 1;
1688.       n--;

crypto/x509/x509_vfy.c:1686:5: 
1684.       cb = ctx->verify_cb;
1685.   
1686. >     n = sk_X509_num(ctx->chain);
1687.       ctx->error_depth = n - 1;
1688.       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:1687:5: 
1685.   
1686.       n = sk_X509_num(ctx->chain);
1687. >     ctx->error_depth = n - 1;
1688.       n--;
1689.       xi = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1688:5: 
1686.       n = sk_X509_num(ctx->chain);
1687.       ctx->error_depth = n - 1;
1688. >     n--;
1689.       xi = sk_X509_value(ctx->chain, n);
1690.   

crypto/x509/x509_vfy.c:1689:10: Condition is true
1687.       ctx->error_depth = n - 1;
1688.       n--;
1689.       xi = sk_X509_value(ctx->chain, n);
                 ^
1690.   
1691.       if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1689:5: 
1687.       ctx->error_depth = n - 1;
1688.       n--;
1689. >     xi = sk_X509_value(ctx->chain, n);
1690.   
1691.       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:1691:9: Taking false branch
1689.       xi = sk_X509_value(ctx->chain, n);
1690.   
1691.       if (ctx->check_issued(ctx, xi, xi))
                ^
1692.           xs = xi;
1693.       else {

crypto/x509/x509_vfy.c:1694:13: Taking false branch
1692.           xs = xi;
1693.       else {
1694.           if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) {
                    ^
1695.               xs = xi;
1696.               goto check_cert;

crypto/x509/x509_vfy.c:1698:13: Taking false branch
1696.               goto check_cert;
1697.           }
1698.           if (n <= 0) {
                    ^
1699.               ctx->error = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
1700.               ctx->current_cert = xi;

crypto/x509/x509_vfy.c:1704:13: 
1702.               goto end;
1703.           } else {
1704. >             n--;
1705.               ctx->error_depth = n;
1706.               xs = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1705:13: 
1703.           } else {
1704.               n--;
1705. >             ctx->error_depth = n;
1706.               xs = sk_X509_value(ctx->chain, n);
1707.           }

crypto/x509/x509_vfy.c:1706:18: Condition is true
1704.               n--;
1705.               ctx->error_depth = n;
1706.               xs = sk_X509_value(ctx->chain, n);
                         ^
1707.           }
1708.       }

crypto/x509/x509_vfy.c:1706:13: 
1704.               n--;
1705.               ctx->error_depth = n;
1706. >             xs = sk_X509_value(ctx->chain, n);
1707.           }
1708.       }

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:1711:12: Loop condition is true. Entering loop body
1709.   
1710.   /*      ctx->error=0;  not needed */
1711.       while (n >= 0) {
                   ^
1712.           ctx->error_depth = n;
1713.   

crypto/x509/x509_vfy.c:1712:9: 
1710.   /*      ctx->error=0;  not needed */
1711.       while (n >= 0) {
1712. >         ctx->error_depth = n;
1713.   
1714.           /*

crypto/x509/x509_vfy.c:1719:14: Taking false branch
1717.            * time.
1718.            */
1719.           if (!xs->valid
                     ^
1720.               && (xs != xi
1721.                   || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) {
