@@ -219,44 +219,45 @@ $ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang \
219
219
./configure --disable-wallet --with-gui=no \
220
220
--with-sanitizers=address,undefined
221
221
$ git apply << "EOF"
222
- diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
223
- index 455a82e39..2faa3f80f 100644
224
- --- a/src/bitcoind.cpp
225
- +++ b/src/bitcoind.cpp
226
- @@ -158,7 +158,11 @@ static bool AppInit(int argc, char* argv[])
227
- return fRet;
228
- }
229
-
222
+ diff --git a/src/compat/compat.h b/src/compat/compat.h
223
+ index 8195bceaec..cce2b31ff0 100644
224
+ --- a/src/compat/compat.h
225
+ +++ b/src/compat/compat.h
226
+ @@ -90,8 +90,12 @@ typedef char* sockopt_arg_type;
227
+ // building with a binutils < 2.36 is subject to this ld bug.
228
+ #define MAIN_FUNCTION __declspec(dllexport) int main(int argc, char* argv[])
229
+ #else
230
230
+#ifdef HFND_FUZZING_ENTRY_FUNCTION_CXX
231
- +HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
231
+ +#define MAIN_FUNCTION HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
232
232
+#else
233
- int main(int argc, char* argv[])
233
+ #define MAIN_FUNCTION int main(int argc, char* argv[])
234
+ #endif
234
235
+#endif
235
- {
236
- #ifdef WIN32
237
- util::WinCmdLineArgs winArgs;
236
+
237
+ // Note these both should work with the current usage of poll, but best to be safe
238
+ // WIN32 poll is broken https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
238
239
diff --git a/src/net.cpp b/src/net.cpp
239
- index cf987b699..636a4176a 100644
240
+ index 7601a6ea84..702d0f56ce 100644
240
241
--- a/src/net.cpp
241
242
+++ b/src/net.cpp
242
- @@ -709 ,7 +709 ,7 @@ int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes )
243
+ @@ -727 ,7 +727 ,7 @@ int V1TransportDeserializer::readHeader(Span< const uint8_t> msg_bytes )
243
244
}
244
245
245
246
// Check start string, network magic
246
247
- if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
247
248
+ if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
248
- LogPrint(BCLog::NET, "HEADER ERROR - MESSAGESTART (%s, %u bytes), received %s , peer=%d\n", hdr.GetCommand(), hdr.nMessageSize , HexStr(hdr.pchMessageStart), m_node_id);
249
+ LogPrint(BCLog::NET, "Header error: Wrong MessageStart %s received, peer=%d\n", HexStr(hdr.pchMessageStart), m_node_id);
249
250
return -1;
250
251
}
251
- @@ -768 ,7 +768 ,7 @@ Optional< CNetMessage> V1TransportDeserializer::GetMessage(const std::chrono::mic
252
+ @@ -788 ,7 +788 ,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
252
253
RandAddEvent(ReadLE32(hash.begin()));
253
254
254
- // Check checksum and header command string
255
+ // Check checksum and header message type string
255
256
- if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
256
257
+ if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
257
- LogPrint(BCLog::NET, "CHECKSUM ERROR (%s, %u bytes), expected %s was %s, peer=%d\n",
258
- SanitizeString(msg->m_command ), msg-> m_message_size,
259
- HexStr(Span<uint8_t>( hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
258
+ LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
259
+ SanitizeString(msg.m_type ), msg. m_message_size,
260
+ HexStr(Span{ hash}.first( CMessageHeader::CHECKSUM_SIZE)),
260
261
EOF
261
262
$ make -C src/ bitcoind
262
263
$ mkdir -p inputs/
0 commit comments