mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge bitcoin/bitcoin#28021: docs: fixup honggfuzz fuzz patch
c1247c3746d4b9ea88a0f9cfb7e71904267b3cd3 docs: fixup honggfuzz patch (fanquake) Pull request description: Closes #28019. ACKs for top commit: brunoerg: ACK c1247c3746d4b9ea88a0f9cfb7e71904267b3cd3 Tree-SHA512: 3f2d146d3d0c24fd25458f6a41e2d20bf6024fc0ea9942ee6254a1b6d0e3c017c55fe79dfbf90652cad64a4d6f026f463b0011dfab065b3d9754ca7047018084
This commit is contained in:
parent
af944b7c8d
commit
2767a13268
@ -212,44 +212,45 @@ $ CC=$(pwd)/honggfuzz/hfuzz_cc/hfuzz-clang \
|
|||||||
./configure --disable-wallet --with-gui=no \
|
./configure --disable-wallet --with-gui=no \
|
||||||
--with-sanitizers=address,undefined
|
--with-sanitizers=address,undefined
|
||||||
$ git apply << "EOF"
|
$ git apply << "EOF"
|
||||||
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
|
diff --git a/src/compat/compat.h b/src/compat/compat.h
|
||||||
index 455a82e39..2faa3f80f 100644
|
index 8195bceaec..cce2b31ff0 100644
|
||||||
--- a/src/bitcoind.cpp
|
--- a/src/compat/compat.h
|
||||||
+++ b/src/bitcoind.cpp
|
+++ b/src/compat/compat.h
|
||||||
@@ -158,7 +158,11 @@ static bool AppInit(int argc, char* argv[])
|
@@ -90,8 +90,12 @@ typedef char* sockopt_arg_type;
|
||||||
return fRet;
|
// building with a binutils < 2.36 is subject to this ld bug.
|
||||||
}
|
#define MAIN_FUNCTION __declspec(dllexport) int main(int argc, char* argv[])
|
||||||
|
#else
|
||||||
+#ifdef HFND_FUZZING_ENTRY_FUNCTION_CXX
|
+#ifdef HFND_FUZZING_ENTRY_FUNCTION_CXX
|
||||||
+HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
|
+#define MAIN_FUNCTION HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
|
||||||
+#else
|
+#else
|
||||||
int main(int argc, char* argv[])
|
#define MAIN_FUNCTION int main(int argc, char* argv[])
|
||||||
|
#endif
|
||||||
+#endif
|
+#endif
|
||||||
{
|
|
||||||
#ifdef WIN32
|
// Note these both should work with the current usage of poll, but best to be safe
|
||||||
util::WinCmdLineArgs winArgs;
|
// WIN32 poll is broken https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
|
||||||
diff --git a/src/net.cpp b/src/net.cpp
|
diff --git a/src/net.cpp b/src/net.cpp
|
||||||
index cf987b699..636a4176a 100644
|
index 7601a6ea84..702d0f56ce 100644
|
||||||
--- a/src/net.cpp
|
--- a/src/net.cpp
|
||||||
+++ b/src/net.cpp
|
+++ b/src/net.cpp
|
||||||
@@ -709,7 +709,7 @@ int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
|
@@ -727,7 +727,7 @@ int V1TransportDeserializer::readHeader(Span<const uint8_t> msg_bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check start string, network magic
|
// Check start string, network magic
|
||||||
- if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
|
- if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
|
||||||
+ if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
|
+ if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
|
||||||
LogPrint(BCLog::NET, "HEADER ERROR - MESSAGESTART (%s, %u bytes), received %s, peer=%d\n", hdr.GetCommand(), hdr.nMessageSize, HexStr(hdr.pchMessageStart), m_node_id);
|
LogPrint(BCLog::NET, "Header error: Wrong MessageStart %s received, peer=%d\n", HexStr(hdr.pchMessageStart), m_node_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -768,7 +768,7 @@ Optional<CNetMessage> V1TransportDeserializer::GetMessage(const std::chrono::mic
|
@@ -788,7 +788,7 @@ CNetMessage V1TransportDeserializer::GetMessage(const std::chrono::microseconds
|
||||||
RandAddEvent(ReadLE32(hash.begin()));
|
RandAddEvent(ReadLE32(hash.begin()));
|
||||||
|
|
||||||
// Check checksum and header command string
|
// Check checksum and header message type string
|
||||||
- if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
|
- if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
|
||||||
+ if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
|
+ if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
|
||||||
LogPrint(BCLog::NET, "CHECKSUM ERROR (%s, %u bytes), expected %s was %s, peer=%d\n",
|
LogPrint(BCLog::NET, "Header error: Wrong checksum (%s, %u bytes), expected %s was %s, peer=%d\n",
|
||||||
SanitizeString(msg->m_command), msg->m_message_size,
|
SanitizeString(msg.m_type), msg.m_message_size,
|
||||||
HexStr(Span<uint8_t>(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
|
HexStr(Span{hash}.first(CMessageHeader::CHECKSUM_SIZE)),
|
||||||
EOF
|
EOF
|
||||||
$ make -C src/ dashd
|
$ make -C src/ dashd
|
||||||
$ mkdir -p inputs/
|
$ mkdir -p inputs/
|
||||||
|
Loading…
Reference in New Issue
Block a user