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


crypto/x509/x509_lu.c:500:1: start of procedure X509_STORE_CTX_get1_certs()
498.   }
499.   
500. > STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
501.   {
502.       int i, idx, cnt;

crypto/x509/x509_lu.c:503:5: 
501.   {
502.       int i, idx, cnt;
503. >     STACK_OF(X509) *sk = NULL;
504.       X509 *x;
505.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:507:5: 
505.       X509_OBJECT *obj;
506.   
507. >     CRYPTO_THREAD_write_lock(ctx->ctx->lock);
508.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
509.       if (idx < 0) {

crypto/threads_pthread.c:63:1: start of procedure CRYPTO_THREAD_write_lock()
  61.   }
  62.   
  63. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  64.   {
  65.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:66:9: Taking true branch
  64.   {
  65.   # ifdef USE_RWLOCK
  66.       if (pthread_rwlock_wrlock(lock) != 0)
                ^
  67.           return 0;
  68.   # else

crypto/threads_pthread.c:67:9: 
  65.   # ifdef USE_RWLOCK
  66.       if (pthread_rwlock_wrlock(lock) != 0)
  67. >         return 0;
  68.   # else
  69.       if (pthread_mutex_lock(lock) != 0)

crypto/threads_pthread.c:74:1: return from a call to CRYPTO_THREAD_write_lock
  72.   
  73.       return 1;
  74. > }
  75.   
  76.   int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)

crypto/x509/x509_lu.c:508:5: Skipping x509_object_idx_cnt(): empty list of specs
506.   
507.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
508.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
           ^
509.       if (idx < 0) {
510.           /*

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

crypto/x509/x509_lu.c:532:5: 
530.       }
531.   
532. >     sk = sk_X509_new_null();
533.       for (i = 0; i < cnt; i++, idx++) {
534.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);

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

crypto/stack/stack.c:99:1: start of procedure OPENSSL_sk_new_null()
    97.   }
    98.   
    99. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);

crypto/stack/stack.c:101:5: Skipping OPENSSL_sk_new(): empty list of specs
    99.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
               ^
    102.   }
    103.   

crypto/stack/stack.c:102:1: return from a call to OPENSSL_sk_new_null
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
    102. > }
    103.   
    104.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

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

crypto/x509/x509_lu.c:533:10: 
531.   
532.       sk = sk_X509_new_null();
533. >     for (i = 0; i < cnt; i++, idx++) {
534.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
535.           x = obj->data.x509;

crypto/x509/x509_lu.c:533:17: Loop condition is true. Entering loop body
531.   
532.       sk = sk_X509_new_null();
533.       for (i = 0; i < cnt; i++, idx++) {
                       ^
534.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
535.           x = obj->data.x509;

crypto/x509/x509_lu.c:534:9: 
532.       sk = sk_X509_new_null();
533.       for (i = 0; i < cnt; i++, idx++) {
534. >         obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
535.           x = obj->data.x509;
536.           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:284:1: start of procedure OPENSSL_sk_value()
    282.   }
    283.   
    284. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)

crypto/stack/stack.c:286:9: Taking true branch
    284.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)
                   ^
    287.           return NULL;
    288.       return (void *)st->data[i];

crypto/stack/stack.c:287:9: 
    285.   {
    286.       if (st == NULL || i < 0 || i >= st->num)
    287. >         return NULL;
    288.       return (void *)st->data[i];
    289.   }

crypto/stack/stack.c:289:1: return from a call to OPENSSL_sk_value
    287.           return NULL;
    288.       return (void *)st->data[i];
    289. > }
    290.   
    291.   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:535:9: 
533.       for (i = 0; i < cnt; i++, idx++) {
534.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
535. >         x = obj->data.x509;
536.           X509_up_ref(x);
537.           if (!sk_X509_push(sk, x)) {
