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


crypto/x509/x509_vfy.c:1683:1: start of procedure internal_verify()
1681.   }
1682.   
1683. > static int internal_verify(X509_STORE_CTX *ctx)
1684.   {
1685.       int ok = 0, n;

crypto/x509/x509_vfy.c:1685:5: 
1683.   static int internal_verify(X509_STORE_CTX *ctx)
1684.   {
1685. >     int ok = 0, n;
1686.       X509 *xs, *xi;
1687.       EVP_PKEY *pkey = NULL;

crypto/x509/x509_vfy.c:1687:5: 
1685.       int ok = 0, n;
1686.       X509 *xs, *xi;
1687. >     EVP_PKEY *pkey = NULL;
1688.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1689.   

crypto/x509/x509_vfy.c:1690:5: 
1688.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1689.   
1690. >     cb = ctx->verify_cb;
1691.   
1692.       n = sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1692:9: Condition is true
1690.       cb = ctx->verify_cb;
1691.   
1692.       n = sk_X509_num(ctx->chain);
                ^
1693.       ctx->error_depth = n - 1;
1694.       n--;

crypto/x509/x509_vfy.c:1692:5: 
1690.       cb = ctx->verify_cb;
1691.   
1692. >     n = sk_X509_num(ctx->chain);
1693.       ctx->error_depth = n - 1;
1694.       n--;

crypto/stack/stack.c:340:1: start of procedure sk_num()
  338.   }
  339.   
  340. > int sk_num(const _STACK *st)
  341.   {
  342.       if (st == NULL)

crypto/stack/stack.c:342:9: Taking false branch
  340.   int sk_num(const _STACK *st)
  341.   {
  342.       if (st == NULL)
                 ^
  343.           return -1;
  344.       return st->num;

crypto/stack/stack.c:344:5: 
  342.       if (st == NULL)
  343.           return -1;
  344. >     return st->num;
  345.   }
  346.   

crypto/stack/stack.c:345:1: return from a call to sk_num
  343.           return -1;
  344.       return st->num;
  345. > }
  346.   
  347.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:1693:5: 
1691.   
1692.       n = sk_X509_num(ctx->chain);
1693. >     ctx->error_depth = n - 1;
1694.       n--;
1695.       xi = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1694:5: 
1692.       n = sk_X509_num(ctx->chain);
1693.       ctx->error_depth = n - 1;
1694. >     n--;
1695.       xi = sk_X509_value(ctx->chain, n);
1696.   

crypto/x509/x509_vfy.c:1695:10: Condition is true
1693.       ctx->error_depth = n - 1;
1694.       n--;
1695.       xi = sk_X509_value(ctx->chain, n);
                 ^
1696.   
1697.       if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1695:5: 
1693.       ctx->error_depth = n - 1;
1694.       n--;
1695. >     xi = sk_X509_value(ctx->chain, n);
1696.   
1697.       if (ctx->check_issued(ctx, xi, xi))

crypto/stack/stack.c:347:1: start of procedure sk_value()
  345.   }
  346.   
  347. > void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                  ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                         ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:28: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:351:5: 
  349.       if (!st || (i < 0) || (i >= st->num))
  350.           return NULL;
  351. >     return st->data[i];
  352.   }
  353.   

crypto/stack/stack.c:352:1: return from a call to sk_value
  350.           return NULL;
  351.       return st->data[i];
  352. > }
  353.   
  354.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1697:9: Taking false branch
1695.       xi = sk_X509_value(ctx->chain, n);
1696.   
1697.       if (ctx->check_issued(ctx, xi, xi))
                ^
1698.           xs = xi;
1699.       else {

crypto/x509/x509_vfy.c:1700:13: Taking false branch
1698.           xs = xi;
1699.       else {
1700.           if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) {
                    ^
1701.               xs = xi;
1702.               goto check_cert;

crypto/x509/x509_vfy.c:1704:13: Taking false branch
1702.               goto check_cert;
1703.           }
1704.           if (n <= 0) {
                    ^
1705.               ctx->error = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
1706.               ctx->current_cert = xi;

crypto/x509/x509_vfy.c:1710:13: 
1708.               goto end;
1709.           } else {
1710. >             n--;
1711.               ctx->error_depth = n;
1712.               xs = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1711:13: 
1709.           } else {
1710.               n--;
1711. >             ctx->error_depth = n;
1712.               xs = sk_X509_value(ctx->chain, n);
1713.           }

crypto/x509/x509_vfy.c:1712:18: Condition is true
1710.               n--;
1711.               ctx->error_depth = n;
1712.               xs = sk_X509_value(ctx->chain, n);
                         ^
1713.           }
1714.       }

crypto/x509/x509_vfy.c:1712:13: 
1710.               n--;
1711.               ctx->error_depth = n;
1712. >             xs = sk_X509_value(ctx->chain, n);
1713.           }
1714.       }

crypto/stack/stack.c:347:1: start of procedure sk_value()
  345.   }
  346.   
  347. > void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:349:10: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                  ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:17: Taking false branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                         ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:349:28: Taking true branch
  347.   void *sk_value(const _STACK *st, int i)
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  350.           return NULL;
  351.       return st->data[i];

crypto/stack/stack.c:350:9: 
  348.   {
  349.       if (!st || (i < 0) || (i >= st->num))
  350. >         return NULL;
  351.       return st->data[i];
  352.   }

crypto/stack/stack.c:352:1: return from a call to sk_value
  350.           return NULL;
  351.       return st->data[i];
  352. > }
  353.   
  354.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1717:12: Loop condition is true. Entering loop body
1715.   
1716.   /*      ctx->error=0;  not needed */
1717.       while (n >= 0) {
                   ^
1718.           ctx->error_depth = n;
1719.   

crypto/x509/x509_vfy.c:1718:9: 
1716.   /*      ctx->error=0;  not needed */
1717.       while (n >= 0) {
1718. >         ctx->error_depth = n;
1719.   
1720.           /*

crypto/x509/x509_vfy.c:1725:14: Taking false branch
1723.            * time.
1724.            */
1725.           if (!xs->valid
                     ^
1726.               && (xs != xi
1727.                   || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) {
