crypto/x509/x509_lu.c:588: error: NULL_DEREFERENCE
  pointer `&obj` last assigned on line 587 could be null and is dereferenced by call to `x509_object_cmp()` at line 588, column 13.
Showing all 41 steps of the trace


crypto/x509/x509_lu.c:576:1: start of procedure X509_OBJECT_retrieve_match()
574.   }
575.   
576. > X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
577.                                           X509_OBJECT *x)
578.   {

crypto/x509/x509_lu.c:581:5: 
579.       int idx, i;
580.       X509_OBJECT *obj;
581. >     idx = sk_X509_OBJECT_find(h, x);
582.       if (idx == -1)
583.           return NULL;

include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_find()
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/stack/stack.c:312:1: start of procedure OPENSSL_sk_find()
    310.   }
    311.   
    312. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
    313.   {
    314.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:314:5: 
    312.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
    313.   {
    314. >     return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    315.   }
    316.   

crypto/stack/stack.c:283:1: start of procedure internal_find()
      281.   }
      282.   
      283. > static int internal_find(OPENSSL_STACK *st, const void *data,
      284.                            int ret_val_options)
      285.   {

crypto/stack/stack.c:289:9: Taking false branch
      287.       int i;
      288.   
      289.       if (st == NULL || st->num == 0)
                     ^
      290.           return -1;
      291.   

crypto/stack/stack.c:289:23: Taking false branch
      287.       int i;
      288.   
      289.       if (st == NULL || st->num == 0)
                                   ^
      290.           return -1;
      291.   

crypto/stack/stack.c:292:9: Taking true branch
      290.           return -1;
      291.   
      292.       if (st->comp == NULL) {
                     ^
      293.           for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)

crypto/stack/stack.c:293:14: 
      291.   
      292.       if (st->comp == NULL) {
      293. >         for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)
      295.                   return i;

crypto/stack/stack.c:293:21: Loop condition is true. Entering loop body
      291.   
      292.       if (st->comp == NULL) {
      293.           for (i = 0; i < st->num; i++)
                                 ^
      294.               if (st->data[i] == data)
      295.                   return i;

crypto/stack/stack.c:294:17: Taking false branch
      292.       if (st->comp == NULL) {
      293.           for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)
                             ^
      295.                   return i;
      296.           return -1;

crypto/stack/stack.c:293:34: 
      291.   
      292.       if (st->comp == NULL) {
      293. >         for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)
      295.                   return i;

crypto/stack/stack.c:293:21: Loop condition is true. Entering loop body
      291.   
      292.       if (st->comp == NULL) {
      293.           for (i = 0; i < st->num; i++)
                                 ^
      294.               if (st->data[i] == data)
      295.                   return i;

crypto/stack/stack.c:294:17: Taking true branch
      292.       if (st->comp == NULL) {
      293.           for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)
                             ^
      295.                   return i;
      296.           return -1;

crypto/stack/stack.c:295:17: 
      293.           for (i = 0; i < st->num; i++)
      294.               if (st->data[i] == data)
      295. >                 return i;
      296.           return -1;
      297.       }

crypto/stack/stack.c:310:1: return from a call to internal_find
      308.   
      309.       return r == NULL ? -1 : (int)((const void **)r - st->data);
      310. > }
      311.   
      312.   int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)

crypto/stack/stack.c:315:1: return from a call to OPENSSL_sk_find
    313.   {
    314.       return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
    315. > }
    316.   
    317.   int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)

include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_find
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/x509/x509_lu.c:582:9: Taking false branch
580.       X509_OBJECT *obj;
581.       idx = sk_X509_OBJECT_find(h, x);
582.       if (idx == -1)
               ^
583.           return NULL;
584.       if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))

crypto/x509/x509_lu.c:584:10: Taking false branch
582.       if (idx == -1)
583.           return NULL;
584.       if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
                ^
585.           return sk_X509_OBJECT_value(h, idx);
586.       for (i = idx; i < sk_X509_OBJECT_num(h); i++) {

crypto/x509/x509_lu.c:586:10: 
584.       if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
585.           return sk_X509_OBJECT_value(h, idx);
586. >     for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
587.           obj = sk_X509_OBJECT_value(h, i);
588.           if (x509_object_cmp

crypto/x509/x509_lu.c:586:19: 
584.       if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
585.           return sk_X509_OBJECT_value(h, idx);
586. >     for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
587.           obj = sk_X509_OBJECT_value(h, i);
588.           if (x509_object_cmp

include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_num()
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/stack/stack.c:376:1: start of procedure OPENSSL_sk_num()
    374.   }
    375.   
    376. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
    377.   {
    378.       return st == NULL ? -1 : st->num;

crypto/stack/stack.c:378:12: Condition is false
    376.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    377.   {
    378.       return st == NULL ? -1 : st->num;
                      ^
    379.   }
    380.   

crypto/stack/stack.c:378:5: 
    376.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
    377.   {
    378. >     return st == NULL ? -1 : st->num;
    379.   }
    380.   

crypto/stack/stack.c:379:1: return from a call to OPENSSL_sk_num
    377.   {
    378.       return st == NULL ? -1 : st->num;
    379. > }
    380.   
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)

include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_num
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/x509/x509_lu.c:586:19: Loop condition is true. Entering loop body
584.       if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
585.           return sk_X509_OBJECT_value(h, idx);
586.       for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
                         ^
587.           obj = sk_X509_OBJECT_value(h, i);
588.           if (x509_object_cmp

crypto/x509/x509_lu.c:587:9: 
585.           return sk_X509_OBJECT_value(h, idx);
586.       for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
587. >         obj = sk_X509_OBJECT_value(h, i);
588.           if (x509_object_cmp
589.               ((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))

include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_value()
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/stack/stack.c:381:1: start of procedure OPENSSL_sk_value()
    379.   }
    380.   
    381. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:383:9: Taking false branch
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    384.           return NULL;
    385.       return (void *)st->data[i];

crypto/stack/stack.c:383:23: Taking true branch
    381.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
                                 ^
    384.           return NULL;
    385.       return (void *)st->data[i];

crypto/stack/stack.c:384:9: 
    382.   {
    383.       if (st == NULL || i < 0 || i >= st->num)
    384. >         return NULL;
    385.       return (void *)st->data[i];
    386.   }

crypto/stack/stack.c:386:1: return from a call to OPENSSL_sk_value
    384.           return NULL;
    385.       return (void *)st->data[i];
    386. > }
    387.   
    388.   void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)

include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_value
  56.   
  57.   DEFINE_STACK_OF(X509_LOOKUP)
  58. > DEFINE_STACK_OF(X509_OBJECT)
  59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  60.   

crypto/x509/x509_lu.c:588:13: 
586.       for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
587.           obj = sk_X509_OBJECT_value(h, i);
588. >         if (x509_object_cmp
589.               ((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
590.               return NULL;

crypto/x509/x509_lu.c:121:1: start of procedure x509_object_cmp()
  119.   }
  120.   
  121. > static int x509_object_cmp(const X509_OBJECT *const *a,
  122.                              const X509_OBJECT *const *b)
  123.   {

crypto/x509/x509_lu.c:126:5: 
  124.       int ret;
  125.   
  126. >     ret = ((*a)->type - (*b)->type);
  127.       if (ret)
  128.           return ret;
