diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-09-29 17:58:47 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-09-29 17:58:50 +0200 |
commit | 419afa93419e6840f78cb94b4a39d826eb10e139 (patch) | |
tree | 13e692d49b38633b91f57775628ad8469a17b41b /src | |
parent | 8d83f9c1d19d9e701291b9906723dfb548d3dc5f (diff) | |
parent | aaaa37abbab69fe1fdc2d332bbaf6ecce0c5cc00 (diff) |
Merge bitcoin/bitcoin#23064: fuzz: Fix memory leak in system fuzz target
aaaa37abbab69fe1fdc2d332bbaf6ecce0c5cc00 fuzz: Fix memory leak in system fuzz target (MarcoFalke)
Pull request description:
Might fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36906
To test:
```
$ FUZZ=system valgrind --tool=massif ./src/test/fuzz/fuzz ../btc_qa_assets/fuzz_seed_corpus/system/
^C
$ massif-visualizer ./massif.out.952024
```
ACKs for top commit:
practicalswift:
cr ACK aaaa37abbab69fe1fdc2d332bbaf6ecce0c5cc00
Tree-SHA512: 6aa47ea12ec76133ae326ed41c31414d7a418abe1f28b05f698e9bb5439bbe26b814c4827999b15b77b47608dbc71c9b35789d0b84e25f56928381d06d6460e5
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/system.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/test/fuzz/system.cpp b/src/test/fuzz/system.cpp index 00403c1a32..dc3f9c8b8f 100644 --- a/src/test/fuzz/system.cpp +++ b/src/test/fuzz/system.cpp @@ -5,6 +5,7 @@ #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> #include <test/fuzz/util.h> +#include <test/util/setup_common.h> #include <util/system.h> #include <cstdint> @@ -12,6 +13,11 @@ #include <vector> namespace { +void initialize_system() +{ + static const auto testing_setup = MakeNoLogFileContext<>(); +} + std::string GetArgumentName(const std::string& name) { size_t idx = name.find('='); @@ -20,9 +26,8 @@ std::string GetArgumentName(const std::string& name) } return name.substr(0, idx); } -} // namespace -FUZZ_TARGET(system) +FUZZ_TARGET_INIT(system, initialize_system) { FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size()); ArgsManager args_manager{}; @@ -114,3 +119,4 @@ FUZZ_TARGET(system) (void)HelpRequested(args_manager); } +} // namespace |