crypto/x509/x509_lu.c:566: error: NULL_DEREFERENCE
  pointer `obj` last assigned on line 565 could be null and is dereferenced at line 566, column 13.
Showing all 26 steps of the trace


crypto/x509/x509_lu.c:528:1: start of procedure X509_STORE_CTX_get1_certs()
526.   }
527.   
528. > STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
529.   {
530.       int i, idx, cnt;

crypto/x509/x509_lu.c:531:5: 
529.   {
530.       int i, idx, cnt;
531. >     STACK_OF(X509) *sk = NULL;
532.       X509 *x;
533.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:535:9: Taking false branch
533.       X509_OBJECT *obj;
534.   
535.       if (ctx->ctx == NULL)
               ^
536.           return NULL;
537.   

crypto/x509/x509_lu.c:538:5: 
536.           return NULL;
537.   
538. >     CRYPTO_THREAD_write_lock(ctx->ctx->lock);
539.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
540.       if (idx < 0) {

crypto/threads_pthread.c:70:1: start of procedure CRYPTO_THREAD_write_lock()
  68.   }
  69.   
  70. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  71.   {
  72.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:73:9: Taking true branch
  71.   {
  72.   # ifdef USE_RWLOCK
  73.       if (pthread_rwlock_wrlock(lock) != 0)
                ^
  74.           return 0;
  75.   # else

crypto/threads_pthread.c:74:9: 
  72.   # ifdef USE_RWLOCK
  73.       if (pthread_rwlock_wrlock(lock) != 0)
  74. >         return 0;
  75.   # else
  76.       if (pthread_mutex_lock(lock) != 0)

crypto/threads_pthread.c:81:1: return from a call to CRYPTO_THREAD_write_lock
  79.   
  80.       return 1;
  81. > }
  82.   
  83.   int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)

crypto/x509/x509_lu.c:539:5: Skipping x509_object_idx_cnt(): empty list of specs
537.   
538.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
539.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
           ^
540.       if (idx < 0) {
541.           /*

crypto/x509/x509_lu.c:540:9: Taking false branch
538.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
539.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
540.       if (idx < 0) {
               ^
541.           /*
542.            * Nothing found in cache: do lookup to possibly add new objects to

crypto/x509/x509_lu.c:563:5: 
561.       }
562.   
563. >     sk = sk_X509_new_null();
564.       for (i = 0; i < cnt; i++, idx++) {
565.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);

include/openssl/x509.h:99:1: start of procedure sk_X509_new_null()
  97.   typedef struct x509_cinf_st X509_CINF;
  98.   
  99. > DEFINE_STACK_OF(X509)
  100.   
  101.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:116:1: start of procedure OPENSSL_sk_new_null()
    114.   }
    115.   
    116. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    117.   {
    118.       return OPENSSL_sk_new_reserve(NULL, 0);

crypto/stack/stack.c:118:5: Skipping OPENSSL_sk_new_reserve(): empty list of specs
    116.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    117.   {
    118.       return OPENSSL_sk_new_reserve(NULL, 0);
               ^
    119.   }
    120.   

crypto/stack/stack.c:119:1: return from a call to OPENSSL_sk_new_null
    117.   {
    118.       return OPENSSL_sk_new_reserve(NULL, 0);
    119. > }
    120.   
    121.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

include/openssl/x509.h:99:1: return from a call to sk_X509_new_null
  97.   typedef struct x509_cinf_st X509_CINF;
  98.   
  99. > DEFINE_STACK_OF(X509)
  100.   
  101.   /* This is used for a table of trust checking functions */

crypto/x509/x509_lu.c:564:10: 
562.   
563.       sk = sk_X509_new_null();
564. >     for (i = 0; i < cnt; i++, idx++) {
565.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
566.           x = obj->data.x509;

crypto/x509/x509_lu.c:564:17: Loop condition is true. Entering loop body
562.   
563.       sk = sk_X509_new_null();
564.       for (i = 0; i < cnt; i++, idx++) {
                       ^
565.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
566.           x = obj->data.x509;

crypto/x509/x509_lu.c:565:9: 
563.       sk = sk_X509_new_null();
564.       for (i = 0; i < cnt; i++, idx++) {
565. >         obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
566.           x = obj->data.x509;
567.           X509_up_ref(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:385:1: start of procedure OPENSSL_sk_value()
    383.   }
    384.   
    385. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    386.   {
    387.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:387:9: Taking true branch
    385.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    386.   {
    387.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    388.           return NULL;
    389.       return (void *)st->data[i];

crypto/stack/stack.c:388:9: 
    386.   {
    387.       if (st == NULL || i < 0 || i >= st->num)
    388. >         return NULL;
    389.       return (void *)st->data[i];
    390.   }

crypto/stack/stack.c:390:1: return from a call to OPENSSL_sk_value
    388.           return NULL;
    389.       return (void *)st->data[i];
    390. > }
    391.   
    392.   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:566:9: 
564.       for (i = 0; i < cnt; i++, idx++) {
565.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
566. >         x = obj->data.x509;
567.           X509_up_ref(x);
568.           if (!sk_X509_push(sk, x)) {
