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


crypto/x509/x509_lu.c:482:1: start of procedure X509_STORE_CTX_get1_certs()
480.   }
481.   
482. > STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
483.   {
484.       int i, idx, cnt;

crypto/x509/x509_lu.c:485:5: 
483.   {
484.       int i, idx, cnt;
485. >     STACK_OF(X509) *sk = NULL;
486.       X509 *x;
487.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:489:5: 
487.       X509_OBJECT *obj;
488.   
489. >     CRYPTO_THREAD_write_lock(ctx->ctx->lock);
490.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
491.       if (idx < 0) {

crypto/threads_pthread.c:36:1: start of procedure CRYPTO_THREAD_write_lock()
  34.   }
  35.   
  36. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  37.   {
  38.       if (pthread_rwlock_wrlock(lock) != 0)

crypto/threads_pthread.c:38:9: Taking true branch
  36.   int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  37.   {
  38.       if (pthread_rwlock_wrlock(lock) != 0)
                ^
  39.           return 0;
  40.   

crypto/threads_pthread.c:39:9: 
  37.   {
  38.       if (pthread_rwlock_wrlock(lock) != 0)
  39. >         return 0;
  40.   
  41.       return 1;

crypto/threads_pthread.c:42:1: return from a call to CRYPTO_THREAD_write_lock
  40.   
  41.       return 1;
  42. > }
  43.   
  44.   int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)

crypto/x509/x509_lu.c:490:5: Skipping x509_object_idx_cnt(): empty list of specs
488.   
489.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
490.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
           ^
491.       if (idx < 0) {
492.           /*

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

crypto/x509/x509_lu.c:514:5: 
512.       }
513.   
514. >     sk = sk_X509_new_null();
515.       for (i = 0; i < cnt; i++, idx++) {
516.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);

include/openssl/x509.h:104:1: start of procedure sk_X509_new_null()
  102.   typedef struct x509_cinf_st X509_CINF;
  103.   
  104. > DEFINE_STACK_OF(X509)
  105.   
  106.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:92:1: start of procedure OPENSSL_sk_new_null()
    90.   }
    91.   
    92. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    93.   {
    94.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);

crypto/stack/stack.c:94:5: Skipping OPENSSL_sk_new(): empty list of specs
    92.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    93.   {
    94.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
              ^
    95.   }
    96.   

crypto/stack/stack.c:95:1: return from a call to OPENSSL_sk_new_null
    93.   {
    94.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
    95. > }
    96.   
    97.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

include/openssl/x509.h:104:1: return from a call to sk_X509_new_null
  102.   typedef struct x509_cinf_st X509_CINF;
  103.   
  104. > DEFINE_STACK_OF(X509)
  105.   
  106.   /* This is used for a table of trust checking functions */

crypto/x509/x509_lu.c:515:10: 
513.   
514.       sk = sk_X509_new_null();
515. >     for (i = 0; i < cnt; i++, idx++) {
516.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
517.           x = obj->data.x509;

crypto/x509/x509_lu.c:515:17: Loop condition is true. Entering loop body
513.   
514.       sk = sk_X509_new_null();
515.       for (i = 0; i < cnt; i++, idx++) {
                       ^
516.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
517.           x = obj->data.x509;

crypto/x509/x509_lu.c:516:9: 
514.       sk = sk_X509_new_null();
515.       for (i = 0; i < cnt; i++, idx++) {
516. >         obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
517.           x = obj->data.x509;
518.           X509_up_ref(x);

include/openssl/x509_vfy.h:54:1: start of procedure sk_X509_OBJECT_value()
  52.   
  53.   DEFINE_STACK_OF(X509_LOOKUP)
  54. > DEFINE_STACK_OF(X509_OBJECT)
  55.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  56.   

crypto/stack/stack.c:272:1: start of procedure OPENSSL_sk_value()
    270.   }
    271.   
    272. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    273.   {
    274.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:274:9: Taking true branch
    272.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    273.   {
    274.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    275.           return NULL;
    276.       return st->data[i];

crypto/stack/stack.c:275:9: 
    273.   {
    274.       if (st == NULL || i < 0 || i >= st->num)
    275. >         return NULL;
    276.       return st->data[i];
    277.   }

crypto/stack/stack.c:277:1: return from a call to OPENSSL_sk_value
    275.           return NULL;
    276.       return st->data[i];
    277. > }
    278.   
    279.   void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, void *value)

include/openssl/x509_vfy.h:54:1: return from a call to sk_X509_OBJECT_value
  52.   
  53.   DEFINE_STACK_OF(X509_LOOKUP)
  54. > DEFINE_STACK_OF(X509_OBJECT)
  55.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  56.   

crypto/x509/x509_lu.c:517:9: 
515.       for (i = 0; i < cnt; i++, idx++) {
516.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
517. >         x = obj->data.x509;
518.           X509_up_ref(x);
519.           if (!sk_X509_push(sk, x)) {
