Skip to content

Commit 3333375

Browse files
author
MarcoFalke
committed
fuzz: Fix uninitialized read in test
1 parent 1a7dec7 commit 3333375

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/test/fuzz/util.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
#include <util/rbf.h>
88
#include <version.h>
99

10+
bool FuzzedSock::Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred ) const
11+
{
12+
if (!m_fuzzed_data_provider.ConsumeBool()) {
13+
return false;
14+
}
15+
if (occurred) *occurred = 0;
16+
return true;
17+
}
1018

1119
void FillNode(FuzzedDataProvider& fuzzed_data_provider, CNode& node, bool init_version) noexcept
1220
{

src/test/fuzz/util.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,10 @@ class FuzzedSock : public Sock
738738
return 0;
739739
}
740740

741-
bool Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred = nullptr) const override
742-
{
743-
return m_fuzzed_data_provider.ConsumeBool();
744-
}
741+
bool Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred = nullptr) const override;
745742

746-
bool IsConnected(std::string& errmsg) const override {
743+
bool IsConnected(std::string& errmsg) const override
744+
{
747745
if (m_fuzzed_data_provider.ConsumeBool()) {
748746
return true;
749747
}

0 commit comments

Comments
 (0)