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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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