mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
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
This commit is contained in:
parent
6d426515a5
commit
3c51f3ab1e
@ -5,6 +5,7 @@
|
|||||||
#include <test/fuzz/FuzzedDataProvider.h>
|
#include <test/fuzz/FuzzedDataProvider.h>
|
||||||
#include <test/fuzz/fuzz.h>
|
#include <test/fuzz/fuzz.h>
|
||||||
#include <test/fuzz/util.h>
|
#include <test/fuzz/util.h>
|
||||||
|
#include <test/util/setup_common.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -12,6 +13,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
void initialize_system()
|
||||||
|
{
|
||||||
|
static const auto testing_setup = MakeNoLogFileContext<>();
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetArgumentName(const std::string& name)
|
std::string GetArgumentName(const std::string& name)
|
||||||
{
|
{
|
||||||
size_t idx = name.find('=');
|
size_t idx = name.find('=');
|
||||||
@ -20,9 +26,8 @@ std::string GetArgumentName(const std::string& name)
|
|||||||
}
|
}
|
||||||
return name.substr(0, idx);
|
return name.substr(0, idx);
|
||||||
}
|
}
|
||||||
} // namespace
|
|
||||||
|
|
||||||
FUZZ_TARGET(system)
|
FUZZ_TARGET_INIT(system, initialize_system)
|
||||||
{
|
{
|
||||||
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
|
||||||
ArgsManager args_manager{};
|
ArgsManager args_manager{};
|
||||||
@ -114,3 +119,4 @@ FUZZ_TARGET(system)
|
|||||||
|
|
||||||
(void)HelpRequested(args_manager);
|
(void)HelpRequested(args_manager);
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user