crypto/rand/rand_lib.c:451: error: NULL_DEREFERENCE
  pointer `meth` last assigned on line 425 could be null and is dereferenced at line 451, column 13.
Showing all 24 steps of the trace


crypto/rand/rand_lib.c:419:1: start of procedure RAND_poll()
417.    * configurable via the --with-rand-seed configure option.
418.    */
419. > int RAND_poll(void)
420.   {
421.       int ret = 0;

crypto/rand/rand_lib.c:421:5: 
419.   int RAND_poll(void)
420.   {
421. >     int ret = 0;
422.   
423.       RAND_POOL *pool = NULL;

crypto/rand/rand_lib.c:423:5: 
421.       int ret = 0;
422.   
423. >     RAND_POOL *pool = NULL;
424.   
425.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:425:5: 
423.       RAND_POOL *pool = NULL;
424.   
425. >     const RAND_METHOD *meth = RAND_get_rand_method();
426.   
427.       if (meth == RAND_OpenSSL()) {

crypto/rand/rand_lib.c:713:1: start of procedure RAND_get_rand_method()
  711.   }
  712.   
  713. > const RAND_METHOD *RAND_get_rand_method(void)
  714.   {
  715.       const RAND_METHOD *tmp_meth = NULL;

crypto/rand/rand_lib.c:715:5: 
  713.   const RAND_METHOD *RAND_get_rand_method(void)
  714.   {
  715. >     const RAND_METHOD *tmp_meth = NULL;
  716.   
  717.       if (!RUN_ONCE(&rand_init, do_rand_init))

crypto/rand/rand_lib.c:717:10: 
  715.       const RAND_METHOD *tmp_meth = NULL;
  716.   
  717. >     if (!RUN_ONCE(&rand_init, do_rand_init))
  718.           return NULL;
  719.   

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 true 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:114:9: 
    112.   {
    113.       if (pthread_once(once, init) != 0)
    114. >         return 0;
    115.   
    116.       return 1;

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/rand/rand_lib.c:717:10: Condition is false
  715.       const RAND_METHOD *tmp_meth = NULL;
  716.   
  717.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  718.           return NULL;
  719.   

crypto/rand/rand_lib.c:717:10: Taking true branch
  715.       const RAND_METHOD *tmp_meth = NULL;
  716.   
  717.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  718.           return NULL;
  719.   

crypto/rand/rand_lib.c:718:9: 
  716.   
  717.       if (!RUN_ONCE(&rand_init, do_rand_init))
  718. >         return NULL;
  719.   
  720.       CRYPTO_THREAD_write_lock(rand_meth_lock);

crypto/rand/rand_lib.c:741:1: return from a call to RAND_get_rand_method
  739.       CRYPTO_THREAD_unlock(rand_meth_lock);
  740.       return tmp_meth;
  741. > }
  742.   
  743.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:427:9: 
425.       const RAND_METHOD *meth = RAND_get_rand_method();
426.   
427. >     if (meth == RAND_OpenSSL()) {
428.           /* fill random pool and seed the master DRBG */
429.           RAND_DRBG *drbg = RAND_DRBG_get0_master();

crypto/rand/drbg_lib.c:1050:1: start of procedure RAND_OpenSSL()
  1048.   };
  1049.   
  1050. > RAND_METHOD *RAND_OpenSSL(void)
  1051.   {
  1052.       return &rand_meth;

crypto/rand/drbg_lib.c:1052:5: 
  1050.   RAND_METHOD *RAND_OpenSSL(void)
  1051.   {
  1052. >     return &rand_meth;
  1053.   }

crypto/rand/drbg_lib.c:1053:1: return from a call to RAND_OpenSSL
  1051.   {
  1052.       return &rand_meth;
  1053. > }

crypto/rand/rand_lib.c:427:9: Taking false branch
425.       const RAND_METHOD *meth = RAND_get_rand_method();
426.   
427.       if (meth == RAND_OpenSSL()) {
               ^
428.           /* fill random pool and seed the master DRBG */
429.           RAND_DRBG *drbg = RAND_DRBG_get0_master();

crypto/rand/rand_lib.c:442:9: Skipping rand_pool_new(): empty list of specs
440.       } else {
441.           /* fill random pool and seed the current legacy RNG */
442.           pool = rand_pool_new(RAND_DRBG_STRENGTH,
               ^
443.                                RAND_DRBG_STRENGTH / 8,
444.                                DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));

crypto/rand/rand_lib.c:445:13: Taking false branch
443.                                RAND_DRBG_STRENGTH / 8,
444.                                DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));
445.           if (pool == NULL)
                   ^
446.               return 0;
447.   

crypto/rand/rand_lib.c:448:13: Taking false branch
446.               return 0;
447.   
448.           if (rand_pool_acquire_entropy(pool) == 0)
                   ^
449.               goto err;
450.   

crypto/rand/rand_lib.c:451:13: 
449.               goto err;
450.   
451. >         if (meth->add == NULL
452.               || meth->add(rand_pool_buffer(pool),
453.                            rand_pool_length(pool),

int RAND_poll(void)
{
    int ret = 0;
    RAND_POOL *pool = NULL;
    const RAND_METHOD *meth = RAND_get_rand_method();
    if (meth == RAND_OpenSSL()) {
        RAND_DRBG *drbg = RAND_DRBG_get0_master();
        if (drbg == NULL)
            return 0;
        rand_drbg_lock(drbg);
        ret = rand_drbg_restart(drbg, NULL, 0, 0);
        rand_drbg_unlock(drbg);
        return ret;
    } else {
        pool = rand_pool_new(RAND_DRBG_STRENGTH,
                             RAND_DRBG_STRENGTH / 8,
                             DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));
        if (pool == NULL)
            return 0;
        if (rand_pool_acquire_entropy(pool) == 0)
            goto err;
        if (meth->add == NULL
            || meth->add(rand_pool_buffer(pool),
                         rand_pool_length(pool),
                         (rand_pool_entropy(pool) / 8.0)) == 0)
            goto err;
        ret = 1;
    }
err:
    rand_pool_free(pool);
    return ret;
}
['int RAND_poll(void)\n{\n    int ret = 0;\n    RAND_POOL *pool = NULL;\n    const RAND_METHOD *meth = RAND_get_rand_method();\n    if (meth == RAND_OpenSSL()) {\n        RAND_DRBG *drbg = RAND_DRBG_get0_master();\n        if (drbg == NULL)\n            return 0;\n        rand_drbg_lock(drbg);\n        ret = rand_drbg_restart(drbg, NULL, 0, 0);\n        rand_drbg_unlock(drbg);\n        return ret;\n    } else {\n        pool = rand_pool_new(RAND_DRBG_STRENGTH,\n                             RAND_DRBG_STRENGTH / 8,\n                             DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));\n        if (pool == NULL)\n            return 0;\n        if (rand_pool_acquire_entropy(pool) == 0)\n            goto err;\n        if (meth->add == NULL\n            || meth->add(rand_pool_buffer(pool),\n                         rand_pool_length(pool),\n                         (rand_pool_entropy(pool) / 8.0)) == 0)\n            goto err;\n        ret = 1;\n    }\nerr:\n    rand_pool_free(pool);\n    return ret;\n}', 'const RAND_METHOD *RAND_get_rand_method(void)\n{\n    const RAND_METHOD *tmp_meth = NULL;\n    if (!RUN_ONCE(&rand_init, do_rand_init))\n        return NULL;\n    CRYPTO_THREAD_write_lock(rand_meth_lock);\n    if (default_RAND_meth == NULL) {\n#ifndef OPENSSL_NO_ENGINE\n        ENGINE *e;\n        if ((e = ENGINE_get_default_RAND()) != NULL\n                && (tmp_meth = ENGINE_get_RAND(e)) != NULL) {\n            funct_ref = e;\n            default_RAND_meth = tmp_meth;\n        } else {\n            ENGINE_finish(e);\n            default_RAND_meth = &rand_meth;\n        }\n#else\n        default_RAND_meth = &rand_meth;\n#endif\n    }\n    tmp_meth = default_RAND_meth;\n    CRYPTO_THREAD_unlock(rand_meth_lock);\n    return tmp_meth;\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}', 'RAND_METHOD *RAND_OpenSSL(void)\n{\n    return &rand_meth;\n}']