test/drbgtest.c:122: error: NULL_DEREFERENCE
  pointer `t` last assigned on line 120 could be null and is dereferenced at line 122, column 5.
Showing all 10 steps of the trace


test/drbgtest.c:117:1: start of procedure kat_entropy()
115.   } TEST_CTX;
116.   
117. > static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout,
118.                             int entropy, size_t min_len, size_t max_len)
119.   {

test/drbgtest.c:120:5: 
118.                             int entropy, size_t min_len, size_t max_len)
119.   {
120. >     TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
121.   
122.       t->entropycnt++;

crypto/rand/drbg_lib.c:332:1: start of procedure RAND_DRBG_get_ex_data()
  330.   }
  331.   
  332. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  333.   {
  334.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);

crypto/rand/drbg_lib.c:334:5: 
  332.   void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  333.   {
  334. >     return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  335.   }
  336.   

crypto/ex_data.c:394:1: start of procedure CRYPTO_get_ex_data()
    392.    * particular index in the class used by this variable
    393.    */
    394. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    395.   {
    396.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:396:9: Taking true branch
    394.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    395.   {
    396.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    397.           return NULL;
    398.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:397:9: 
    395.   {
    396.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    397. >         return NULL;
    398.       return sk_void_value(ad->sk, idx);
    399.   }

crypto/ex_data.c:399:1: return from a call to CRYPTO_get_ex_data
    397.           return NULL;
    398.       return sk_void_value(ad->sk, idx);
    399. > }

crypto/rand/drbg_lib.c:335:1: return from a call to RAND_DRBG_get_ex_data
  333.   {
  334.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  335. > }
  336.   
  337.   

test/drbgtest.c:122:5: 
120.       TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
121.   
122. >     t->entropycnt++;
123.       *pout = (unsigned char *)t->entropy;
124.       return t->entropylen;

static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout,
                          int entropy, size_t min_len, size_t max_len)
{
    TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
    t->entropycnt++;
    *pout = (unsigned char *)t->entropy;
    return t->entropylen;
}
['static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout,\n                          int entropy, size_t min_len, size_t max_len)\n{\n    TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);\n    t->entropycnt++;\n    *pout = (unsigned char *)t->entropy;\n    return t->entropylen;\n}', 'void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)\n{\n    return CRYPTO_get_ex_data(&drbg->ex_data, idx);\n}', 'void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)\n{\n    if (ad->sk == NULL || idx >= sk_void_num(ad->sk))\n        return NULL;\n    return sk_void_value(ad->sk, idx);\n}']