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


crypto/rand/rand_lib.c:411:1: start of procedure RAND_poll()
409.    * configurable via the --with-rand-seed configure option.
410.    */
411. > int RAND_poll(void)
412.   {
413.       int ret = 0;

crypto/rand/rand_lib.c:413:5: 
411.   int RAND_poll(void)
412.   {
413. >     int ret = 0;
414.   
415.       RAND_POOL *pool = NULL;

crypto/rand/rand_lib.c:415:5: 
413.       int ret = 0;
414.   
415. >     RAND_POOL *pool = NULL;
416.   
417.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:417:5: 
415.       RAND_POOL *pool = NULL;
416.   
417. >     const RAND_METHOD *meth = RAND_get_rand_method();
418.   
419.       if (meth == RAND_OpenSSL()) {

crypto/rand/rand_lib.c:727:1: start of procedure RAND_get_rand_method()
  725.   }
  726.   
  727. > const RAND_METHOD *RAND_get_rand_method(void)
  728.   {
  729.       const RAND_METHOD *tmp_meth = NULL;

crypto/rand/rand_lib.c:729:5: 
  727.   const RAND_METHOD *RAND_get_rand_method(void)
  728.   {
  729. >     const RAND_METHOD *tmp_meth = NULL;
  730.   
  731.       if (!RUN_ONCE(&rand_init, do_rand_init))

crypto/rand/rand_lib.c:731:10: 
  729.       const RAND_METHOD *tmp_meth = NULL;
  730.   
  731. >     if (!RUN_ONCE(&rand_init, do_rand_init))
  732.           return NULL;
  733.   

crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
    103.   }
    104.   
    105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking true branch
    105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)
                   ^
    108.           return 0;
    109.   

crypto/threads_pthread.c:108:9: 
    106.   {
    107.       if (pthread_once(once, init) != 0)
    108. >         return 0;
    109.   
    110.       return 1;

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
    109.   
    110.       return 1;
    111. > }
    112.   
    113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/rand/rand_lib.c:731:10: Condition is false
  729.       const RAND_METHOD *tmp_meth = NULL;
  730.   
  731.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  732.           return NULL;
  733.   

crypto/rand/rand_lib.c:731:10: Taking true branch
  729.       const RAND_METHOD *tmp_meth = NULL;
  730.   
  731.       if (!RUN_ONCE(&rand_init, do_rand_init))
                  ^
  732.           return NULL;
  733.   

crypto/rand/rand_lib.c:732:9: 
  730.   
  731.       if (!RUN_ONCE(&rand_init, do_rand_init))
  732. >         return NULL;
  733.   
  734.       CRYPTO_THREAD_write_lock(rand_meth_lock);

crypto/rand/rand_lib.c:755:1: return from a call to RAND_get_rand_method
  753.       CRYPTO_THREAD_unlock(rand_meth_lock);
  754.       return tmp_meth;
  755. > }
  756.   
  757.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:419:9: 
417.       const RAND_METHOD *meth = RAND_get_rand_method();
418.   
419. >     if (meth == RAND_OpenSSL()) {
420.           /* fill random pool and seed the master DRBG */
421.           RAND_DRBG *drbg = RAND_DRBG_get0_master();

crypto/rand/drbg_lib.c:986:1: start of procedure RAND_OpenSSL()
  984.   };
  985.   
  986. > RAND_METHOD *RAND_OpenSSL(void)
  987.   {
  988.       return &rand_meth;

crypto/rand/drbg_lib.c:988:5: 
  986.   RAND_METHOD *RAND_OpenSSL(void)
  987.   {
  988. >     return &rand_meth;
  989.   }

crypto/rand/drbg_lib.c:989:1: return from a call to RAND_OpenSSL
  987.   {
  988.       return &rand_meth;
  989. > }

crypto/rand/rand_lib.c:419:9: Taking false branch
417.       const RAND_METHOD *meth = RAND_get_rand_method();
418.   
419.       if (meth == RAND_OpenSSL()) {
               ^
420.           /* fill random pool and seed the master DRBG */
421.           RAND_DRBG *drbg = RAND_DRBG_get0_master();

crypto/rand/rand_lib.c:434:9: Skipping RAND_POOL_new(): empty list of specs
432.       } else {
433.           /* fill random pool and seed the current legacy RNG */
434.           pool = RAND_POOL_new(RAND_DRBG_STRENGTH,
               ^
435.                                RAND_DRBG_STRENGTH / 8,
436.                                DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));

crypto/rand/rand_lib.c:437:13: Taking false branch
435.                                RAND_DRBG_STRENGTH / 8,
436.                                DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));
437.           if (pool == NULL)
                   ^
438.               return 0;
439.   

crypto/rand/rand_lib.c:440:13: Taking false branch
438.               return 0;
439.   
440.           if (RAND_POOL_acquire_entropy(pool) == 0)
                   ^
441.               goto err;
442.   

crypto/rand/rand_lib.c:443:13: 
441.               goto err;
442.   
443. >         if (meth->add == NULL
444.               || meth->add(RAND_POOL_buffer(pool),
445.                            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}']