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


crypto/x509/x509_vfy.c:1727:1: start of procedure internal_verify()
1725.   }
1726.   
1727. > static int internal_verify(X509_STORE_CTX *ctx)
1728.   {
1729.       int ok = 0, n;

crypto/x509/x509_vfy.c:1729:5: 
1727.   static int internal_verify(X509_STORE_CTX *ctx)
1728.   {
1729. >     int ok = 0, n;
1730.       X509 *xs, *xi;
1731.       EVP_PKEY *pkey = NULL;

crypto/x509/x509_vfy.c:1731:5: 
1729.       int ok = 0, n;
1730.       X509 *xs, *xi;
1731. >     EVP_PKEY *pkey = NULL;
1732.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1733.   

crypto/x509/x509_vfy.c:1734:5: 
1732.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1733.   
1734. >     cb = ctx->verify_cb;
1735.   
1736.       n = sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1736:9: Condition is true
1734.       cb = ctx->verify_cb;
1735.   
1736.       n = sk_X509_num(ctx->chain);
                ^
1737.       ctx->error_depth = n - 1;
1738.       n--;

crypto/x509/x509_vfy.c:1736:5: 
1734.       cb = ctx->verify_cb;
1735.   
1736. >     n = sk_X509_num(ctx->chain);
1737.       ctx->error_depth = n - 1;
1738.       n--;

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

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

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

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

crypto/x509/x509_vfy.c:1737:5: 
1735.   
1736.       n = sk_X509_num(ctx->chain);
1737. >     ctx->error_depth = n - 1;
1738.       n--;
1739.       xi = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1738:5: 
1736.       n = sk_X509_num(ctx->chain);
1737.       ctx->error_depth = n - 1;
1738. >     n--;
1739.       xi = sk_X509_value(ctx->chain, n);
1740.   

crypto/x509/x509_vfy.c:1739:10: Condition is true
1737.       ctx->error_depth = n - 1;
1738.       n--;
1739.       xi = sk_X509_value(ctx->chain, n);
                 ^
1740.   
1741.       if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1739:5: 
1737.       ctx->error_depth = n - 1;
1738.       n--;
1739. >     xi = sk_X509_value(ctx->chain, n);
1740.   
1741.       if (ctx->check_issued(ctx, xi, xi))

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

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

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

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

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

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

crypto/x509/x509_vfy.c:1741:9: Taking false branch
1739.       xi = sk_X509_value(ctx->chain, n);
1740.   
1741.       if (ctx->check_issued(ctx, xi, xi))
                ^
1742.           xs = xi;
1743.       else {

crypto/x509/x509_vfy.c:1744:13: Taking false branch
1742.           xs = xi;
1743.       else {
1744.           if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) {
                    ^
1745.               xs = xi;
1746.               goto check_cert;

crypto/x509/x509_vfy.c:1748:13: Taking false branch
1746.               goto check_cert;
1747.           }
1748.           if (n <= 0) {
                    ^
1749.               ctx->error = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
1750.               ctx->current_cert = xi;

crypto/x509/x509_vfy.c:1754:13: 
1752.               goto end;
1753.           } else {
1754. >             n--;
1755.               ctx->error_depth = n;
1756.               xs = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1755:13: 
1753.           } else {
1754.               n--;
1755. >             ctx->error_depth = n;
1756.               xs = sk_X509_value(ctx->chain, n);
1757.           }

crypto/x509/x509_vfy.c:1756:18: Condition is true
1754.               n--;
1755.               ctx->error_depth = n;
1756.               xs = sk_X509_value(ctx->chain, n);
                         ^
1757.           }
1758.       }

crypto/x509/x509_vfy.c:1756:13: 
1754.               n--;
1755.               ctx->error_depth = n;
1756. >             xs = sk_X509_value(ctx->chain, n);
1757.           }
1758.       }

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

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

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

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

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

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

crypto/x509/x509_vfy.c:1761:12: Loop condition is true. Entering loop body
1759.   
1760.   /*      ctx->error=0;  not needed */
1761.       while (n >= 0) {
                   ^
1762.           ctx->error_depth = n;
1763.   

crypto/x509/x509_vfy.c:1762:9: 
1760.   /*      ctx->error=0;  not needed */
1761.       while (n >= 0) {
1762. >         ctx->error_depth = n;
1763.   
1764.           /*

crypto/x509/x509_vfy.c:1769:14: Taking false branch
1767.            * time.
1768.            */
1769.           if (!xs->valid
                     ^
1770.               && (xs != xi
1771.                   || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) {
