crypto/x509/x509_lu.c:303: error: NULL_DEREFERENCE
  pointer `lu` last assigned on line 302 could be null and is dereferenced by call to `X509_LOOKUP_by_subject()` at line 303, column 17.
Showing all 54 steps of the trace


crypto/x509/x509_lu.c:287:1: start of procedure X509_STORE_get_by_subject()
285.   }
286.   
287. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,
288.                                 X509_NAME *name, X509_OBJECT *ret)
289.   {

crypto/x509/x509_lu.c:290:5: 
288.                                 X509_NAME *name, X509_OBJECT *ret)
289.   {
290. >     X509_STORE *ctx = vs->ctx;
291.       X509_LOOKUP *lu;
292.       X509_OBJECT stmp, *tmp;

crypto/x509/x509_lu.c:295:5: 
293.       int i, j;
294.   
295. >     CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
296.       tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);
297.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

crypto/lock.c:414:1: start of procedure CRYPTO_lock()
  412.   }
  413.   
  414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  415.   {
  416.   #ifdef LOCK_DEBUG

crypto/lock.c:441:9: Taking false branch
  439.       }
  440.   #endif
  441.       if (type < 0) {
                 ^
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:452:16: Taking true branch
  450.               CRYPTO_destroy_dynlockid(type);
  451.           }
  452.       } else if (locking_callback != NULL)
                        ^
  453.           locking_callback(mode, type, file, line);
  454.   }

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
  451.           }
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
                 ^
  454.   }
  455.   

crypto/lock.c:441:5: 
  439.       }
  440.   #endif
  441. >     if (type < 0) {
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:454:1: return from a call to CRYPTO_lock
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
  454. > }
  455.   
  456.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509/x509_lu.c:296:5: 
294.   
295.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
296. >     tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);
297.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
298.   

crypto/x509/x509_lu.c:468:1: start of procedure X509_OBJECT_retrieve_by_subject()
  466.   }
  467.   
  468. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
  469.                                                int type, X509_NAME *name)
  470.   {

crypto/x509/x509_lu.c:472:5: 
  470.   {
  471.       int idx;
  472. >     idx = X509_OBJECT_idx_by_subject(h, type, name);
  473.       if (idx == -1)
  474.           return NULL;

crypto/x509/x509_lu.c:462:1: start of procedure X509_OBJECT_idx_by_subject()
    460.   }
    461.   
    462. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
    463.                                  X509_NAME *name)
    464.   {

crypto/x509/x509_lu.c:465:5: Skipping x509_object_idx_cnt(): empty list of specs
    463.                                  X509_NAME *name)
    464.   {
    465.       return x509_object_idx_cnt(h, type, name, NULL);
               ^
    466.   }
    467.   

crypto/x509/x509_lu.c:466:1: return from a call to X509_OBJECT_idx_by_subject
    464.   {
    465.       return x509_object_idx_cnt(h, type, name, NULL);
    466. > }
    467.   
    468.   X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,

crypto/x509/x509_lu.c:473:9: Taking false branch
  471.       int idx;
  472.       idx = X509_OBJECT_idx_by_subject(h, type, name);
  473.       if (idx == -1)
                 ^
  474.           return NULL;
  475.       return sk_X509_OBJECT_value(h, idx);

crypto/x509/x509_lu.c:475:5: 
  473.       if (idx == -1)
  474.           return NULL;
  475. >     return sk_X509_OBJECT_value(h, idx);
  476.   }
  477.   

include/openssl/x509_vfy.h:124:1: start of procedure sk_X509_OBJECT_value()
    122.   
    123.   DEFINE_STACK_OF(X509_LOOKUP)
    124. > DEFINE_STACK_OF(X509_OBJECT)
    125.   
    126.   /* This is a static that defines the function interface */

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)

include/openssl/x509_vfy.h:124:1: return from a call to sk_X509_OBJECT_value
    122.   
    123.   DEFINE_STACK_OF(X509_LOOKUP)
    124. > DEFINE_STACK_OF(X509_OBJECT)
    125.   
    126.   /* This is a static that defines the function interface */

crypto/x509/x509_lu.c:476:1: return from a call to X509_OBJECT_retrieve_by_subject
  474.           return NULL;
  475.       return sk_X509_OBJECT_value(h, idx);
  476. > }
  477.   
  478.   STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)

crypto/x509/x509_lu.c:297:5: 
295.       CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
296.       tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);
297. >     CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
298.   
299.       if (tmp == NULL || type == X509_LU_CRL) {

crypto/lock.c:414:1: start of procedure CRYPTO_lock()
  412.   }
  413.   
  414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  415.   {
  416.   #ifdef LOCK_DEBUG

crypto/lock.c:441:9: Taking false branch
  439.       }
  440.   #endif
  441.       if (type < 0) {
                 ^
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:452:16: Taking true branch
  450.               CRYPTO_destroy_dynlockid(type);
  451.           }
  452.       } else if (locking_callback != NULL)
                        ^
  453.           locking_callback(mode, type, file, line);
  454.   }

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
  451.           }
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
                 ^
  454.   }
  455.   

crypto/lock.c:441:5: 
  439.       }
  440.   #endif
  441. >     if (type < 0) {
  442.           if (dynlock_lock_callback != NULL) {
  443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:454:1: return from a call to CRYPTO_lock
  452.       } else if (locking_callback != NULL)
  453.           locking_callback(mode, type, file, line);
  454. > }
  455.   
  456.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509/x509_lu.c:299:9: Taking false branch
297.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
298.   
299.       if (tmp == NULL || type == X509_LU_CRL) {
               ^
300.           for (i = vs->current_method;
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {

crypto/x509/x509_lu.c:299:24: Taking true branch
297.       CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
298.   
299.       if (tmp == NULL || type == X509_LU_CRL) {
                              ^
300.           for (i = vs->current_method;
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {

crypto/x509/x509_lu.c:300:14: 
298.   
299.       if (tmp == NULL || type == X509_LU_CRL) {
300. >         for (i = vs->current_method;
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
302.               lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);

crypto/x509/x509_lu.c:301:14: 
299.       if (tmp == NULL || type == X509_LU_CRL) {
300.           for (i = vs->current_method;
301. >              i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
302.               lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);
303.               j = X509_LOOKUP_by_subject(lu, type, name, &stmp);

include/openssl/x509_vfy.h:123:1: start of procedure sk_X509_LOOKUP_num()
  121.   typedef struct x509_lookup_st X509_LOOKUP;
  122.   
  123. > DEFINE_STACK_OF(X509_LOOKUP)
  124.   DEFINE_STACK_OF(X509_OBJECT)
  125.   

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 true branch
    317.   int sk_num(const _STACK *st)
    318.   {
    319.       if (st == NULL)
                   ^
    320.           return -1;
    321.       return st->num;

crypto/stack/stack.c:320:9: 
    318.   {
    319.       if (st == NULL)
    320. >         return -1;
    321.       return st->num;
    322.   }

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)

include/openssl/x509_vfy.h:123:1: return from a call to sk_X509_LOOKUP_num
  121.   typedef struct x509_lookup_st X509_LOOKUP;
  122.   
  123. > DEFINE_STACK_OF(X509_LOOKUP)
  124.   DEFINE_STACK_OF(X509_OBJECT)
  125.   

crypto/x509/x509_lu.c:301:14: Loop condition is true. Entering loop body
299.       if (tmp == NULL || type == X509_LU_CRL) {
300.           for (i = vs->current_method;
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
                    ^
302.               lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);
303.               j = X509_LOOKUP_by_subject(lu, type, name, &stmp);

crypto/x509/x509_lu.c:302:13: 
300.           for (i = vs->current_method;
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
302. >             lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);
303.               j = X509_LOOKUP_by_subject(lu, type, name, &stmp);
304.               if (j < 0) {

include/openssl/x509_vfy.h:123:1: start of procedure sk_X509_LOOKUP_value()
  121.   typedef struct x509_lookup_st X509_LOOKUP;
  122.   
  123. > DEFINE_STACK_OF(X509_LOOKUP)
  124.   DEFINE_STACK_OF(X509_OBJECT)
  125.   

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 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)

include/openssl/x509_vfy.h:123:1: return from a call to sk_X509_LOOKUP_value
  121.   typedef struct x509_lookup_st X509_LOOKUP;
  122.   
  123. > DEFINE_STACK_OF(X509_LOOKUP)
  124.   DEFINE_STACK_OF(X509_OBJECT)
  125.   

crypto/x509/x509_lu.c:303:13: 
301.                i < sk_X509_LOOKUP_num(ctx->get_cert_methods); i++) {
302.               lu = sk_X509_LOOKUP_value(ctx->get_cert_methods, i);
303. >             j = X509_LOOKUP_by_subject(lu, type, name, &stmp);
304.               if (j < 0) {
305.                   vs->current_method = j;

crypto/x509/x509_lu.c:123:1: start of procedure X509_LOOKUP_by_subject()
  121.   }
  122.   
  123. > int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
  124.                              X509_OBJECT *ret)
  125.   {

crypto/x509/x509_lu.c:126:10: 
  124.                              X509_OBJECT *ret)
  125.   {
  126. >     if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
  127.           return X509_LU_FAIL;
  128.       if (ctx->skip)
