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


crypto/x509/x509_vfy.c:1716:1: start of procedure internal_verify()
1714.   }
1715.   
1716. > static int internal_verify(X509_STORE_CTX *ctx)
1717.   {
1718.       int ok = 0, n;

crypto/x509/x509_vfy.c:1718:5: 
1716.   static int internal_verify(X509_STORE_CTX *ctx)
1717.   {
1718. >     int ok = 0, n;
1719.       X509 *xs, *xi;
1720.       EVP_PKEY *pkey = NULL;

crypto/x509/x509_vfy.c:1720:5: 
1718.       int ok = 0, n;
1719.       X509 *xs, *xi;
1720. >     EVP_PKEY *pkey = NULL;
1721.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1722.   

crypto/x509/x509_vfy.c:1723:5: 
1721.       int (*cb) (int xok, X509_STORE_CTX *xctx);
1722.   
1723. >     cb = ctx->verify_cb;
1724.   
1725.       n = sk_X509_num(ctx->chain);

crypto/x509/x509_vfy.c:1725:9: Condition is true
1723.       cb = ctx->verify_cb;
1724.   
1725.       n = sk_X509_num(ctx->chain);
                ^
1726.       ctx->error_depth = n - 1;
1727.       n--;

crypto/x509/x509_vfy.c:1725:5: 
1723.       cb = ctx->verify_cb;
1724.   
1725. >     n = sk_X509_num(ctx->chain);
1726.       ctx->error_depth = n - 1;
1727.       n--;

crypto/stack/stack.c:327:1: start of procedure sk_num()
  325.   }
  326.   
  327. > int sk_num(const _STACK *st)
  328.   {
  329.       if (st == NULL)

crypto/stack/stack.c:329:9: Taking false branch
  327.   int sk_num(const _STACK *st)
  328.   {
  329.       if (st == NULL)
                 ^
  330.           return -1;
  331.       return st->num;

crypto/stack/stack.c:331:5: 
  329.       if (st == NULL)
  330.           return -1;
  331. >     return st->num;
  332.   }
  333.   

crypto/stack/stack.c:332:1: return from a call to sk_num
  330.           return -1;
  331.       return st->num;
  332. > }
  333.   
  334.   void *sk_value(const _STACK *st, int i)

crypto/x509/x509_vfy.c:1726:5: 
1724.   
1725.       n = sk_X509_num(ctx->chain);
1726. >     ctx->error_depth = n - 1;
1727.       n--;
1728.       xi = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1727:5: 
1725.       n = sk_X509_num(ctx->chain);
1726.       ctx->error_depth = n - 1;
1727. >     n--;
1728.       xi = sk_X509_value(ctx->chain, n);
1729.   

crypto/x509/x509_vfy.c:1728:10: Condition is true
1726.       ctx->error_depth = n - 1;
1727.       n--;
1728.       xi = sk_X509_value(ctx->chain, n);
                 ^
1729.   
1730.       if (ctx->check_issued(ctx, xi, xi))

crypto/x509/x509_vfy.c:1728:5: 
1726.       ctx->error_depth = n - 1;
1727.       n--;
1728. >     xi = sk_X509_value(ctx->chain, n);
1729.   
1730.       if (ctx->check_issued(ctx, xi, xi))

crypto/stack/stack.c:334:1: start of procedure sk_value()
  332.   }
  333.   
  334. > void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:336:10: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                  ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:17: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                         ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:28: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:338:5: 
  336.       if (!st || (i < 0) || (i >= st->num))
  337.           return NULL;
  338. >     return st->data[i];
  339.   }
  340.   

crypto/stack/stack.c:339:1: return from a call to sk_value
  337.           return NULL;
  338.       return st->data[i];
  339. > }
  340.   
  341.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1730:9: Taking false branch
1728.       xi = sk_X509_value(ctx->chain, n);
1729.   
1730.       if (ctx->check_issued(ctx, xi, xi))
                ^
1731.           xs = xi;
1732.       else {

crypto/x509/x509_vfy.c:1733:13: Taking false branch
1731.           xs = xi;
1732.       else {
1733.           if (ctx->param->flags & X509_V_FLAG_PARTIAL_CHAIN) {
                    ^
1734.               xs = xi;
1735.               goto check_cert;

crypto/x509/x509_vfy.c:1737:13: Taking false branch
1735.               goto check_cert;
1736.           }
1737.           if (n <= 0) {
                    ^
1738.               ctx->error = X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE;
1739.               ctx->current_cert = xi;

crypto/x509/x509_vfy.c:1743:13: 
1741.               goto end;
1742.           } else {
1743. >             n--;
1744.               ctx->error_depth = n;
1745.               xs = sk_X509_value(ctx->chain, n);

crypto/x509/x509_vfy.c:1744:13: 
1742.           } else {
1743.               n--;
1744. >             ctx->error_depth = n;
1745.               xs = sk_X509_value(ctx->chain, n);
1746.           }

crypto/x509/x509_vfy.c:1745:18: Condition is true
1743.               n--;
1744.               ctx->error_depth = n;
1745.               xs = sk_X509_value(ctx->chain, n);
                         ^
1746.           }
1747.       }

crypto/x509/x509_vfy.c:1745:13: 
1743.               n--;
1744.               ctx->error_depth = n;
1745. >             xs = sk_X509_value(ctx->chain, n);
1746.           }
1747.       }

crypto/stack/stack.c:334:1: start of procedure sk_value()
  332.   }
  333.   
  334. > void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:336:10: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                  ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:17: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                         ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:28: Taking true branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:337:9: 
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
  337. >         return NULL;
  338.       return st->data[i];
  339.   }

crypto/stack/stack.c:339:1: return from a call to sk_value
  337.           return NULL;
  338.       return st->data[i];
  339. > }
  340.   
  341.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_vfy.c:1750:12: Loop condition is true. Entering loop body
1748.   
1749.   /*      ctx->error=0;  not needed */
1750.       while (n >= 0) {
                   ^
1751.           ctx->error_depth = n;
1752.   

crypto/x509/x509_vfy.c:1751:9: 
1749.   /*      ctx->error=0;  not needed */
1750.       while (n >= 0) {
1751. >         ctx->error_depth = n;
1752.   
1753.           /*

crypto/x509/x509_vfy.c:1758:14: Taking false branch
1756.            * time.
1757.            */
1758.           if (!xs->valid
                     ^
1759.               && (xs != xi
1760.                   || (ctx->param->flags & X509_V_FLAG_CHECK_SS_SIGNATURE))) {
