test/drbgtest.c:518: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 516 could be null and is dereferenced at line 518, column 9.
Showing all 13 steps of the trace


test/drbgtest.c:511:1: start of procedure get_entropy_hook()
509.   
510.   /* Intercepts and counts calls to the get_entropy() callback */
511. > static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout,
512.                                 int entropy, size_t min_len, size_t max_len,
513.                                 int prediction_resistance)

test/drbgtest.c:516:5: 
514.   {
515.       size_t ret;
516. >     HOOK_CTX *ctx = get_hook_ctx(drbg);
517.   
518.       if (ctx->fail != 0)

test/drbgtest.c:505:1: start of procedure get_hook_ctx()
  503.   static HOOK_CTX master_ctx, public_ctx, private_ctx;
  504.   
  505. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg)
  506.   {
  507.       return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);

test/drbgtest.c:507:5: 
  505.   static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg)
  506.   {
  507. >     return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
  508.   }
  509.   

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/drbgtest.c:508:1: return from a call to get_hook_ctx
  506.   {
  507.       return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
  508. > }
  509.   
  510.   /* Intercepts and counts calls to the get_entropy() callback */

test/drbgtest.c:518:9: 
516.       HOOK_CTX *ctx = get_hook_ctx(drbg);
517.   
518. >     if (ctx->fail != 0)
519.           return 0;
520.   
