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


crypto/x509/x509_lu.c:492:1: start of procedure X509_STORE_CTX_get1_certs()
490.   }
491.   
492. > STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
493.   {
494.       int i, idx, cnt;

crypto/x509/x509_lu.c:495:5: 
493.   {
494.       int i, idx, cnt;
495. >     STACK_OF(X509) *sk = NULL;
496.       X509 *x;
497.       X509_OBJECT *obj;

crypto/x509/x509_lu.c:499:5: 
497.       X509_OBJECT *obj;
498.   
499. >     CRYPTO_THREAD_write_lock(ctx->ctx->lock);
500.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
501.       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:500:5: Skipping x509_object_idx_cnt(): empty list of specs
498.   
499.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
500.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
           ^
501.       if (idx < 0) {
502.           /*

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

crypto/x509/x509_lu.c:524:5: 
522.       }
523.   
524. >     sk = sk_X509_new_null();
525.       for (i = 0; i < cnt; i++, idx++) {
526.           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:525:10: 
523.   
524.       sk = sk_X509_new_null();
525. >     for (i = 0; i < cnt; i++, idx++) {
526.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
527.           x = obj->data.x509;

crypto/x509/x509_lu.c:525:17: Loop condition is true. Entering loop body
523.   
524.       sk = sk_X509_new_null();
525.       for (i = 0; i < cnt; i++, idx++) {
                       ^
526.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
527.           x = obj->data.x509;

crypto/x509/x509_lu.c:526:9: 
524.       sk = sk_X509_new_null();
525.       for (i = 0; i < cnt; i++, idx++) {
526. >         obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
527.           x = obj->data.x509;
528.           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:527:9: 
525.       for (i = 0; i < cnt; i++, idx++) {
526.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
527. >         x = obj->data.x509;
528.           X509_up_ref(x);
529.           if (!sk_X509_push(sk, x)) {
