test/evp_test.c:484: error: NULL_DEREFERENCE
  pointer `cdat` last assigned on line 483 could be null and is dereferenced at line 484, column 5.
Showing all 67 steps of the trace


test/evp_test.c:469:1: start of procedure cipher_test_init()
467.   } CIPHER_DATA;
468.   
469. > static int cipher_test_init(EVP_TEST *t, const char *alg)
470.   {
471.       const EVP_CIPHER *cipher;

test/evp_test.c:475:9: 
473.       int m;
474.   
475. >     if ((cipher = EVP_get_cipherbyname(alg)) == NULL) {
476.           /* If alg has an OID assume disabled algorithm */
477.           if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {

crypto/evp/names.c:58:1: start of procedure EVP_get_cipherbyname()
  56.   }
  57.   
  58. > const EVP_CIPHER *EVP_get_cipherbyname(const char *name)
  59.   {
  60.       const EVP_CIPHER *cp;

crypto/evp/names.c:62:10: Taking false branch
  60.       const EVP_CIPHER *cp;
  61.   
  62.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL))
                 ^
  63.           return NULL;
  64.   

crypto/evp/names.c:65:5: 
  63.           return NULL;
  64.   
  65. >     cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
  66.       return cp;
  67.   }

crypto/objects/o_names.c:172:1: start of procedure OBJ_NAME_get()
    170.   }
    171.   
    172. > const char *OBJ_NAME_get(const char *name, int type)
    173.   {
    174.       OBJ_NAME on, *ret;

crypto/objects/o_names.c:175:5: 
    173.   {
    174.       OBJ_NAME on, *ret;
    175. >     int num = 0, alias;
    176.       const char *value = NULL;
    177.   

crypto/objects/o_names.c:176:5: 
    174.       OBJ_NAME on, *ret;
    175.       int num = 0, alias;
    176. >     const char *value = NULL;
    177.   
    178.       if (name == NULL)

crypto/objects/o_names.c:178:9: Taking false branch
    176.       const char *value = NULL;
    177.   
    178.       if (name == NULL)
                   ^
    179.           return NULL;
    180.       if (!OBJ_NAME_init())

crypto/objects/o_names.c:180:10: 
    178.       if (name == NULL)
    179.           return NULL;
    180. >     if (!OBJ_NAME_init())
    181.           return NULL;
    182.       CRYPTO_THREAD_read_lock(obj_lock);

crypto/objects/o_names.c:76:1: start of procedure OBJ_NAME_init()
      74.   }
      75.   
      76. > int OBJ_NAME_init(void)
      77.   {
      78.       return RUN_ONCE(&init, o_names_init);

crypto/objects/o_names.c:78:12: 
      76.   int OBJ_NAME_init(void)
      77.   {
      78. >     return RUN_ONCE(&init, o_names_init);
      79.   }
      80.   

crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
        109.   }
        110.   
        111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
        112.   {
        113.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:113:9: Taking false branch
        111.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
        112.   {
        113.       if (pthread_once(once, init) != 0)
                       ^
        114.           return 0;
        115.   

crypto/threads_pthread.c:116:5: 
        114.           return 0;
        115.   
        116. >     return 1;
        117.   }
        118.   

crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
        115.   
        116.       return 1;
        117. > }
        118.   
        119.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/objects/o_names.c:78:12: Condition is true
      76.   int OBJ_NAME_init(void)
      77.   {
      78.       return RUN_ONCE(&init, o_names_init);
                       ^
      79.   }
      80.   

crypto/objects/o_names.c:78:5: 
      76.   int OBJ_NAME_init(void)
      77.   {
      78. >     return RUN_ONCE(&init, o_names_init);
      79.   }
      80.   

crypto/objects/o_names.c:79:1: return from a call to OBJ_NAME_init
      77.   {
      78.       return RUN_ONCE(&init, o_names_init);
      79. > }
      80.   
      81.   int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),

crypto/objects/o_names.c:180:10: Taking false branch
    178.       if (name == NULL)
    179.           return NULL;
    180.       if (!OBJ_NAME_init())
                    ^
    181.           return NULL;
    182.       CRYPTO_THREAD_read_lock(obj_lock);

crypto/objects/o_names.c:182:5: 
    180.       if (!OBJ_NAME_init())
    181.           return NULL;
    182. >     CRYPTO_THREAD_read_lock(obj_lock);
    183.   
    184.       alias = type & OBJ_NAME_ALIAS;

crypto/threads_pthread.c:57:1: start of procedure CRYPTO_THREAD_read_lock()
      55.   }
      56.   
      57. > int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
      58.   {
      59.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:60:9: Taking true branch
      58.   {
      59.   # ifdef USE_RWLOCK
      60.       if (pthread_rwlock_rdlock(lock) != 0)
                    ^
      61.           return 0;
      62.   # else

crypto/threads_pthread.c:61:9: 
      59.   # ifdef USE_RWLOCK
      60.       if (pthread_rwlock_rdlock(lock) != 0)
      61. >         return 0;
      62.   # else
      63.       if (pthread_mutex_lock(lock) != 0)

crypto/threads_pthread.c:68:1: return from a call to CRYPTO_THREAD_read_lock
      66.   
      67.       return 1;
      68. > }
      69.   
      70.   int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)

crypto/objects/o_names.c:184:5: 
    182.       CRYPTO_THREAD_read_lock(obj_lock);
    183.   
    184. >     alias = type & OBJ_NAME_ALIAS;
    185.       type &= ~OBJ_NAME_ALIAS;
    186.   

crypto/objects/o_names.c:185:5: 
    183.   
    184.       alias = type & OBJ_NAME_ALIAS;
    185. >     type &= ~OBJ_NAME_ALIAS;
    186.   
    187.       on.name = name;

crypto/objects/o_names.c:187:5: 
    185.       type &= ~OBJ_NAME_ALIAS;
    186.   
    187. >     on.name = name;
    188.       on.type = type;
    189.   

crypto/objects/o_names.c:188:5: 
    186.   
    187.       on.name = name;
    188. >     on.type = type;
    189.   
    190.       for (;;) {

crypto/objects/o_names.c:202:5: Loop condition is true. Entering loop body
    200.               break;
    201.           }
    202.       }
               ^
    203.   
    204.       CRYPTO_THREAD_unlock(obj_lock);

crypto/objects/o_names.c:191:9: 
    189.   
    190.       for (;;) {
    191. >         ret = lh_OBJ_NAME_retrieve(names_lh, &on);
    192.           if (ret == NULL)
    193.               break;

crypto/objects/obj_lcl.h:12:1: start of procedure lh_OBJ_NAME_retrieve()
      10.   typedef struct name_funcs_st NAME_FUNCS;
      11.   DEFINE_STACK_OF(NAME_FUNCS)
      12. > DEFINE_LHASH_OF(OBJ_NAME);
      13.   typedef struct added_obj_st ADDED_OBJ;
      14.   DEFINE_LHASH_OF(ADDED_OBJ);

crypto/lhash/lhash.c:156:1: start of procedure OPENSSL_LH_retrieve()
        154.   }
        155.   
        156. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)
        157.   {
        158.       unsigned long hash;

crypto/lhash/lhash.c:162:5: 
        160.       void *ret;
        161.   
        162. >     tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
        163.   
        164.       rn = getrn(lh, data, &hash);

crypto/lhash/lhash.c:164:5: Skipping getrn(): empty list of specs
        162.       tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
        163.   
        164.       rn = getrn(lh, data, &hash);
                   ^
        165.   
        166.       if (*rn == NULL) {

crypto/lhash/lhash.c:166:9: Taking false branch
        164.       rn = getrn(lh, data, &hash);
        165.   
        166.       if (*rn == NULL) {
                       ^
        167.           tsan_counter(&lh->num_retrieve_miss);
        168.           return NULL;

crypto/lhash/lhash.c:170:9: 
        168.           return NULL;
        169.       } else {
        170. >         ret = (*rn)->data;
        171.           tsan_counter(&lh->num_retrieve);
        172.       }

crypto/lhash/lhash.c:171:9: 
        169.       } else {
        170.           ret = (*rn)->data;
        171. >         tsan_counter(&lh->num_retrieve);
        172.       }
        173.   

crypto/lhash/lhash.c:174:5: 
        172.       }
        173.   
        174. >     return ret;
        175.   }
        176.   

crypto/lhash/lhash.c:175:1: return from a call to OPENSSL_LH_retrieve
        173.   
        174.       return ret;
        175. > }
        176.   
        177.   static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,

crypto/objects/obj_lcl.h:12:1: return from a call to lh_OBJ_NAME_retrieve
      10.   typedef struct name_funcs_st NAME_FUNCS;
      11.   DEFINE_STACK_OF(NAME_FUNCS)
      12. > DEFINE_LHASH_OF(OBJ_NAME);
      13.   typedef struct added_obj_st ADDED_OBJ;
      14.   DEFINE_LHASH_OF(ADDED_OBJ);

crypto/objects/o_names.c:192:13: Taking false branch
    190.       for (;;) {
    191.           ret = lh_OBJ_NAME_retrieve(names_lh, &on);
    192.           if (ret == NULL)
                       ^
    193.               break;
    194.           if ((ret->alias) && !alias) {

crypto/objects/o_names.c:194:13: Taking false branch
    192.           if (ret == NULL)
    193.               break;
    194.           if ((ret->alias) && !alias) {
                       ^
    195.               if (++num > 10)
    196.                   break;

crypto/objects/o_names.c:199:13: 
    197.               on.name = ret->data;
    198.           } else {
    199. >             value = ret->data;
    200.               break;
    201.           }

crypto/objects/o_names.c:204:5: 
    202.       }
    203.   
    204. >     CRYPTO_THREAD_unlock(obj_lock);
    205.       return value;
    206.   }

crypto/threads_pthread.c:83:1: start of procedure CRYPTO_THREAD_unlock()
      81.   }
      82.   
      83. > int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)
      84.   {
      85.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:86:9: Taking true branch
      84.   {
      85.   # ifdef USE_RWLOCK
      86.       if (pthread_rwlock_unlock(lock) != 0)
                    ^
      87.           return 0;
      88.   # else

crypto/threads_pthread.c:87:9: 
      85.   # ifdef USE_RWLOCK
      86.       if (pthread_rwlock_unlock(lock) != 0)
      87. >         return 0;
      88.   # else
      89.       if (pthread_mutex_unlock(lock) != 0)

crypto/threads_pthread.c:94:1: return from a call to CRYPTO_THREAD_unlock
      92.   
      93.       return 1;
      94. > }
      95.   
      96.   void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock)

crypto/objects/o_names.c:205:5: 
    203.   
    204.       CRYPTO_THREAD_unlock(obj_lock);
    205. >     return value;
    206.   }
    207.   

crypto/objects/o_names.c:206:1: return from a call to OBJ_NAME_get
    204.       CRYPTO_THREAD_unlock(obj_lock);
    205.       return value;
    206. > }
    207.   
    208.   int OBJ_NAME_add(const char *name, int type, const char *data)

crypto/evp/names.c:66:5: 
  64.   
  65.       cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
  66. >     return cp;
  67.   }
  68.   

crypto/evp/names.c:67:1: return from a call to EVP_get_cipherbyname
  65.       cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
  66.       return cp;
  67. > }
  68.   
  69.   const EVP_MD *EVP_get_digestbyname(const char *name)

test/evp_test.c:475:9: Taking false branch
473.       int m;
474.   
475.       if ((cipher = EVP_get_cipherbyname(alg)) == NULL) {
               ^
476.           /* If alg has an OID assume disabled algorithm */
477.           if (OBJ_sn2nid(alg) != NID_undef || OBJ_ln2nid(alg) != NID_undef) {

test/evp_test.c:483:5: 
481.           return 0;
482.       }
483. >     cdat = OPENSSL_zalloc(sizeof(*cdat));
484.       cdat->cipher = cipher;
485.       cdat->enc = -1;

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
  226.   }
  227.   
  228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230. >     void *ret = CRYPTO_malloc(num, file, line);
  231.   
  232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
    190.   #endif
    191.   
    192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194.       void *ret = NULL;

crypto/mem.c:194:5: 
    192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194. >     void *ret = NULL;
    195.   
    196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:197:32: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                          ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    198.           return malloc_impl(num, file, line);
                   ^
    199.   
    200.       if (num == 0)

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
    224.   
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking false branch
  231.   
  232.       FAILTEST();
  233.       if (ret != NULL)
                 ^
  234.           memset(ret, 0, num);
  235.       return ret;

crypto/mem.c:235:5: 
  233.       if (ret != NULL)
  234.           memset(ret, 0, num);
  235. >     return ret;
  236.   }
  237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
  234.           memset(ret, 0, num);
  235.       return ret;
  236. > }
  237.   
  238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

test/evp_test.c:484:5: 
482.       }
483.       cdat = OPENSSL_zalloc(sizeof(*cdat));
484. >     cdat->cipher = cipher;
485.       cdat->enc = -1;
486.       m = EVP_CIPHER_mode(cipher);
