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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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}']