MCPcopy Create free account
hub / github.com/ElementsProject/elements / Connect

Method Connect

src/test/fuzz/util.cpp:141–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int FuzzedSock::Connect(const sockaddr*, socklen_t) const
142{
143 // Have a permanent error at connect_errnos[0] because when the fuzzed data is exhausted
144 // SetFuzzedErrNo() will always return the first element and we want to avoid Connect()
145 // returning -1 and setting errno to EAGAIN repeatedly.
146 constexpr std::array connect_errnos{
147 ECONNREFUSED,
148 EAGAIN,
149 ECONNRESET,
150 EHOSTUNREACH,
151 EINPROGRESS,
152 EINTR,
153 ENETUNREACH,
154 ETIMEDOUT,
155 };
156 if (m_fuzzed_data_provider.ConsumeBool()) {
157 SetFuzzedErrNo(m_fuzzed_data_provider, connect_errnos);
158 return -1;
159 }
160 return 0;
161}
162
163std::unique_ptr<Sock> FuzzedSock::Accept(sockaddr* addr, socklen_t* addr_len) const
164{

Callers 2

BOOST_AUTO_TEST_CASEFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45

Calls 2

SetFuzzedErrNoFunction · 0.85
ConsumeBoolMethod · 0.80

Tested by

no test coverage detected