fuzz: Access fuzzing context in test_one_input #20232

issue dongcarl opened this issue on October 23, 2020
  1. dongcarl commented at 7:40 PM on October 23, 2020: member

    After #20158, previous initialization behaviour and call patterns that relied on side-effects affecting our global g_chainman will no longer be possible. This means that 2 fuzz tests will break as we now need a local reference to a CChainState:

    https://github.com/bitcoin/bitcoin/blob/49984b44cfcd3fd0cef16c8ce97197973afc3c04/src/test/fuzz/coins_view.cpp#L280-L285 https://github.com/bitcoin/bitcoin/blob/49984b44cfcd3fd0cef16c8ce97197973afc3c04/src/test/fuzz/load_external_block_file.cpp#L30

    We do initialize a TestingSetup with InitializeFuzzingContext in some fuzz tests, but test_one_input has no way to access it.


    TL;DR I'm wondering what's the best change to make the TestingSetup initialized in InitializeFuzzingContext accessible in test_one_input

  2. dongcarl commented at 5:10 PM on October 26, 2020: member
  3. MarcoFalke commented at 6:55 AM on October 27, 2020: member

    Not sure what the question is. Arey you asking whether it is possible to have globals when fuzzing? Then yes, take a look at src/test/fuzz/process_message.cpp (g_setup)

  4. MarcoFalke closed this on Mar 12, 2021

  5. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-01 03:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me