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


test/drbg_cavs_test.c:34:1: start of procedure kat_entropy()
32.   } TEST_CTX;
33.   
34. > static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout,
35.                             int entropy, size_t min_len, size_t max_len,
36.                             int prediction_resistance)

test/drbg_cavs_test.c:38:5: 
36.                             int prediction_resistance)
37.   {
38. >     TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
39.   
40.       t->entropycnt++;

crypto/rand/drbg_lib.c:874:1: start of procedure RAND_DRBG_get_ex_data()
  872.   }
  873.   
  874. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  875.   {
  876.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);

crypto/rand/drbg_lib.c:876:5: 
  874.   void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  875.   {
  876. >     return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  877.   }
  878.   

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

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

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

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

crypto/rand/drbg_lib.c:877:1: return from a call to RAND_DRBG_get_ex_data
  875.   {
  876.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  877. > }
  878.   
  879.   

test/drbg_cavs_test.c:40:5: 
38.       TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
39.   
40. >     t->entropycnt++;
41.       *pout = (unsigned char *)t->entropy;
42.       return t->entropylen;

static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout,
                          int entropy, size_t min_len, size_t max_len,
                          int prediction_resistance)
{
    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                          int prediction_resistance)\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}']