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


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

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

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

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

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

crypto/x509/x509_vfy.c:1737:5: 
1735.       cb = ctx->verify_cb;
1736.   
1737. >     n = sk_X509_num(ctx->chain);
1738.       ctx->error_depth = n - 1;
1739.       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:1738:5: 
1736.   
1737.       n = sk_X509_num(ctx->chain);
1738. >     ctx->error_depth = n - 1;
1739.       n--;
1740.       xi = sk_X509_value(ctx->chain, n);

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

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

crypto/x509/x509_vfy.c:1740:5: 
1738.       ctx->error_depth = n - 1;
1739.       n--;
1740. >     xi = sk_X509_value(ctx->chain, n);
1741.   
1742.       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:1742:9: Taking false branch
1740.       xi = sk_X509_value(ctx->chain, n);
1741.   
1742.       if (ctx->check_issued(ctx, xi, xi))
                ^
1743.           xs = xi;
1744.       else {

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

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

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

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

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

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

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:1762:12: Loop condition is true. Entering loop body
1760.   
1761.   /*      ctx->error=0;  not needed */
1762.       while (n >= 0) {
                   ^
1763.           ctx->error_depth = n;
1764.   

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

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