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


test/drbg_cavs_test.c:45:1: start of procedure kat_nonce()
43.   }
44.   
45. > static size_t kat_nonce(RAND_DRBG *drbg, unsigned char **pout,
46.                           int entropy, size_t min_len, size_t max_len)
47.   {

test/drbg_cavs_test.c:48:5: 
46.                           int entropy, size_t min_len, size_t max_len)
47.   {
48. >     TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
49.   
50.       t->noncecnt++;

crypto/rand/drbg_lib.c:929:1: start of procedure RAND_DRBG_get_ex_data()
  927.   }
  928.   
  929. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  930.   {
  931.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);

crypto/rand/drbg_lib.c:931:5: 
  929.   void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
  930.   {
  931. >     return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  932.   }
  933.   

crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data()
    456.    * particular index in the class used by this variable
    457.    */
    458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))

crypto/ex_data.c:460:9: Taking true branch
    458.   void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
                   ^
    461.           return NULL;
    462.       return sk_void_value(ad->sk, idx);

crypto/ex_data.c:461:9: 
    459.   {
    460.       if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
    461. >         return NULL;
    462.       return sk_void_value(ad->sk, idx);
    463.   }

crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data
    461.           return NULL;
    462.       return sk_void_value(ad->sk, idx);
    463. > }
    464.   
    465.   OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad)

crypto/rand/drbg_lib.c:932:1: return from a call to RAND_DRBG_get_ex_data
  930.   {
  931.       return CRYPTO_get_ex_data(&drbg->ex_data, idx);
  932. > }
  933.   
  934.   

test/drbg_cavs_test.c:50:5: 
48.       TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
49.   
50. >     t->noncecnt++;
51.       *pout = (unsigned char *)t->nonce;
52.       return t->noncelen;

static size_t kat_nonce(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->noncecnt++;
    *pout = (unsigned char *)t->nonce;
    return t->noncelen;
}
['static size_t kat_nonce(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->noncecnt++;\n    *pout = (unsigned char *)t->nonce;\n    return t->noncelen;\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}']