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


crypto/x509/x509_lu.c:518:1: start of procedure X509_STORE_get1_certs()
516.   }
517.   
518. > STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)
519.   {
520.       int i, idx, cnt;

crypto/x509/x509_lu.c:524:5: 
522.       X509 *x;
523.       X509_OBJECT *obj;
524. >     sk = sk_X509_new_null();
525.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
526.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);

include/openssl/x509.h:151:1: start of procedure sk_X509_new_null()
  149.   typedef struct x509_cinf_st X509_CINF;
  150.   
  151. > DEFINE_STACK_OF(X509)
  152.   
  153.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:144:1: start of procedure sk_new_null()
    142.   }
    143.   
    144. > _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:146:5: Skipping sk_new(): empty list of specs
    144.   _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
               ^
    147.   }
    148.   

crypto/stack/stack.c:147:1: return from a call to sk_new_null
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
    147. > }
    148.   
    149.   _STACK *sk_new(int (*c) (const void *, const void *))

include/openssl/x509.h:151:1: return from a call to sk_X509_new_null
  149.   typedef struct x509_cinf_st X509_CINF;
  150.   
  151. > DEFINE_STACK_OF(X509)
  152.   
  153.   /* This is used for a table of trust checking functions */

crypto/x509/x509_lu.c:525:5: 
523.       X509_OBJECT *obj;
524.       sk = sk_X509_new_null();
525. >     CRYPTO_THREAD_write_lock(ctx->ctx->lock);
526.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
527.       if (idx < 0) {

crypto/threads_pthread.c:77:1: start of procedure CRYPTO_THREAD_write_lock()
  75.   }
  76.   
  77. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  78.   {
  79.       if (pthread_rwlock_wrlock(lock) != 0)

crypto/threads_pthread.c:79:9: Taking true branch
  77.   int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
  78.   {
  79.       if (pthread_rwlock_wrlock(lock) != 0)
                ^
  80.           return 0;
  81.   

crypto/threads_pthread.c:80:9: 
  78.   {
  79.       if (pthread_rwlock_wrlock(lock) != 0)
  80. >         return 0;
  81.   
  82.       return 1;

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

crypto/x509/x509_lu.c:526:5: Skipping x509_object_idx_cnt(): empty list of specs
524.       sk = sk_X509_new_null();
525.       CRYPTO_THREAD_write_lock(ctx->ctx->lock);
526.       idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt);
           ^
527.       if (idx < 0) {
528.           /*

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

crypto/x509/x509_lu.c:547:10: 
545.           }
546.       }
547. >     for (i = 0; i < cnt; i++, idx++) {
548.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
549.           x = obj->data.x509;

crypto/x509/x509_lu.c:547:17: Loop condition is true. Entering loop body
545.           }
546.       }
547.       for (i = 0; i < cnt; i++, idx++) {
                       ^
548.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
549.           x = obj->data.x509;

crypto/x509/x509_lu.c:548:9: 
546.       }
547.       for (i = 0; i < cnt; i++, idx++) {
548. >         obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
549.           x = obj->data.x509;
550.           X509_up_ref(x);

include/openssl/x509_vfy.h:102:1: start of procedure sk_X509_OBJECT_value()
  100.   
  101.   DEFINE_STACK_OF(X509_LOOKUP)
  102. > DEFINE_STACK_OF(X509_OBJECT)
  103.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  104.   

crypto/stack/stack.c:323:1: start of procedure sk_value()
    321.   }
    322.   
    323. > void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:325:10: Taking true branch
    323.   void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
                    ^
    326.           return NULL;
    327.       return st->data[i];

crypto/stack/stack.c:326:9: 
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
    326. >         return NULL;
    327.       return st->data[i];
    328.   }

crypto/stack/stack.c:328:1: return from a call to sk_value
    326.           return NULL;
    327.       return st->data[i];
    328. > }
    329.   
    330.   void *sk_set(_STACK *st, int i, void *value)

include/openssl/x509_vfy.h:102:1: return from a call to sk_X509_OBJECT_value
  100.   
  101.   DEFINE_STACK_OF(X509_LOOKUP)
  102. > DEFINE_STACK_OF(X509_OBJECT)
  103.   DEFINE_STACK_OF(X509_VERIFY_PARAM)
  104.   

crypto/x509/x509_lu.c:549:9: 
547.       for (i = 0; i < cnt; i++, idx++) {
548.           obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
549. >         x = obj->data.x509;
550.           X509_up_ref(x);
551.           if (!sk_X509_push(sk, x)) {
