crypto/x509/x509_vfy.c:731: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 729 could be null and is dereferenced at line 731, column 19.
Showing all 66 steps of the trace


crypto/x509/x509_vfy.c:723:1: start of procedure check_name_constraints()
721.   }
722.   
723. > static int check_name_constraints(X509_STORE_CTX *ctx)
724.   {
725.       X509 *x;

crypto/x509/x509_vfy.c:728:14: Condition is true
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
                    ^
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:728:10: 
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728. >     for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

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:728:43: Loop condition is true. Entering loop body
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
                                                 ^
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:729:13: Condition is true
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
                   ^
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

crypto/x509/x509_vfy.c:729:9: 
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729. >         x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

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:731:13: Taking true branch
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))
                   ^
732.               continue;
733.           /*

crypto/x509/x509_vfy.c:731:19: Taking true branch
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))
                         ^
732.               continue;
733.           /*

crypto/x509/x509_vfy.c:728:51: 
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728. >     for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:728:43: Loop condition is true. Entering loop body
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
                                                 ^
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:729:13: Condition is true
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
                   ^
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

crypto/x509/x509_vfy.c:729:9: 
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729. >         x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

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:731:13: Taking true branch
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))
                   ^
732.               continue;
733.           /*

crypto/x509/x509_vfy.c:731:19: Taking false branch
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))
                         ^
732.               continue;
733.           /*

crypto/x509/x509_vfy.c:739:18: Condition is true
737.            * to be obeyed.
738.            */
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
                        ^
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {

crypto/x509/x509_vfy.c:739:14: 
737.            * to be obeyed.
738.            */
739. >         for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {

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:739:47: Loop condition is true. Entering loop body
737.            * to be obeyed.
738.            */
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
                                                     ^
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {

crypto/x509/x509_vfy.c:740:36: Condition is true
738.            */
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
                                          ^
741.               if (nc) {
742.                   rv = NAME_CONSTRAINTS_check(x, nc);

crypto/x509/x509_vfy.c:740:13: 
738.            */
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
740. >             NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {
742.                   rv = NAME_CONSTRAINTS_check(x, nc);

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:741:17: Taking true branch
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {
                       ^
742.                   rv = NAME_CONSTRAINTS_check(x, nc);
743.                   if (rv != X509_V_OK) {

crypto/x509/x509_vfy.c:742:17: Skipping NAME_CONSTRAINTS_check(): empty list of specs
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {
742.                   rv = NAME_CONSTRAINTS_check(x, nc);
                       ^
743.                   if (rv != X509_V_OK) {
744.                       ctx->error = rv;

crypto/x509/x509_vfy.c:743:21: Taking true branch
741.               if (nc) {
742.                   rv = NAME_CONSTRAINTS_check(x, nc);
743.                   if (rv != X509_V_OK) {
                           ^
744.                       ctx->error = rv;
745.                       ctx->error_depth = i;

crypto/x509/x509_vfy.c:744:21: 
742.                   rv = NAME_CONSTRAINTS_check(x, nc);
743.                   if (rv != X509_V_OK) {
744. >                     ctx->error = rv;
745.                       ctx->error_depth = i;
746.                       ctx->current_cert = x;

crypto/x509/x509_vfy.c:745:21: 
743.                   if (rv != X509_V_OK) {
744.                       ctx->error = rv;
745. >                     ctx->error_depth = i;
746.                       ctx->current_cert = x;
747.                       if (!ctx->verify_cb(0, ctx))

crypto/x509/x509_vfy.c:746:21: 
744.                       ctx->error = rv;
745.                       ctx->error_depth = i;
746. >                     ctx->current_cert = x;
747.                       if (!ctx->verify_cb(0, ctx))
748.                           return 0;

crypto/x509/x509_vfy.c:747:26: Taking false branch
745.                       ctx->error_depth = i;
746.                       ctx->current_cert = x;
747.                       if (!ctx->verify_cb(0, ctx))
                                ^
748.                           return 0;
749.                   }

crypto/x509/x509_vfy.c:739:54: 
737.            * to be obeyed.
738.            */
739. >         for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {

crypto/x509/x509_vfy.c:739:47: Loop condition is false. Leaving loop
737.            * to be obeyed.
738.            */
739.           for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
                                                     ^
740.               NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
741.               if (nc) {

crypto/x509/x509_vfy.c:728:51: 
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728. >     for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:728:43: Loop condition is true. Entering loop body
726.       int i, j, rv;
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
                                                 ^
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */

crypto/x509/x509_vfy.c:729:13: Condition is true
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729.           x = sk_X509_value(ctx->chain, i);
                   ^
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

crypto/x509/x509_vfy.c:729:9: 
727.       /* Check name constraints for all certificates */
728.       for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
729. >         x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))

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:731:13: Taking true branch
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731.           if (i && (x->ex_flags & EXFLAG_SI))
                   ^
732.               continue;
733.           /*

crypto/x509/x509_vfy.c:731:19: 
729.           x = sk_X509_value(ctx->chain, i);
730.           /* Ignore self issued certs unless last in chain */
731. >         if (i && (x->ex_flags & EXFLAG_SI))
732.               continue;
733.           /*

static int check_name_constraints(X509_STORE_CTX *ctx)
{
    X509 *x;
    int i, j, rv;
    for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {
        x = sk_X509_value(ctx->chain, i);
        if (i && (x->ex_flags & EXFLAG_SI))
            continue;
        for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {
            NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
            if (nc) {
                rv = NAME_CONSTRAINTS_check(x, nc);
                if (rv != X509_V_OK) {
                    ctx->error = rv;
                    ctx->error_depth = i;
                    ctx->current_cert = x;
                    if (!ctx->verify_cb(0, ctx))
                        return 0;
                }
            }
        }
    }
    return 1;
}
['static int check_name_constraints(X509_STORE_CTX *ctx)\n{\n    X509 *x;\n    int i, j, rv;\n    for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--) {\n        x = sk_X509_value(ctx->chain, i);\n        if (i && (x->ex_flags & EXFLAG_SI))\n            continue;\n        for (j = sk_X509_num(ctx->chain) - 1; j > i; j--) {\n            NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;\n            if (nc) {\n                rv = NAME_CONSTRAINTS_check(x, nc);\n                if (rv != X509_V_OK) {\n                    ctx->error = rv;\n                    ctx->error_depth = i;\n                    ctx->current_cert = x;\n                    if (!ctx->verify_cb(0, ctx))\n                        return 0;\n                }\n            }\n        }\n    }\n    return 1;\n}', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}']