docs: “Fuzzing the Bitcoin Core P2P layer using Honggfuzz NetDriver” is outdated #28019

issue brunoerg openend this issue on July 1, 2023
  1. brunoerg commented at 9:39 pm on July 1, 2023: contributor

    Due to changes to the functions V1TransportDeserializer::readHeader and V1TransportDeserializer::GetMessage, the “Fuzzing the Bitcoin Core P2P layer using Honggfuzz NetDriver” section in fuzzing.md is outdated. The git apply command doesn’t work.

     0$ git apply << "EOF"
     1diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
     2index 455a82e39..2faa3f80f 100644
     3--- a/src/bitcoind.cpp
     4+++ b/src/bitcoind.cpp
     5@@ -158,7 +158,11 @@ static bool AppInit(int argc, char* argv[])
     6     return fRet;
     7 }
     8
     9+#ifdef HFND_FUZZING_ENTRY_FUNCTION_CXX
    10+HFND_FUZZING_ENTRY_FUNCTION_CXX(int argc, char* argv[])
    11+#else
    12 int main(int argc, char* argv[])
    13+#endif
    14 {
    15 #ifdef WIN32
    16     util::WinCmdLineArgs winArgs;
    17diff --git a/src/net.cpp b/src/net.cpp
    18index cf987b699..636a4176a 100644
    19--- a/src/net.cpp
    20+++ b/src/net.cpp
    21@@ -709,7 +709,7 @@ int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
    22     }
    23
    24     // Check start string, network magic
    25-    if (memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) {
    26+    if (false && memcmp(hdr.pchMessageStart, m_chain_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE) != 0) { // skip network magic checking
    27         LogPrint(BCLog::NET, "HEADER ERROR - MESSAGESTART (%s, %u bytes), received %s, peer=%d\n", hdr.GetCommand(), hdr.nMessageSize, HexStr(hdr.pchMessageStart), m_node_id);
    28         return -1;
    29     }
    30@@ -768,7 +768,7 @@ Optional<CNetMessage> V1TransportDeserializer::GetMessage(const std::chrono::mic
    31     RandAddEvent(ReadLE32(hash.begin()));
    32
    33     // Check checksum and header command string
    34-    if (memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) {
    35+    if (false && memcmp(hash.begin(), hdr.pchChecksum, CMessageHeader::CHECKSUM_SIZE) != 0) { // skip checksum checking
    36         LogPrint(BCLog::NET, "CHECKSUM ERROR (%s, %u bytes), expected %s was %s, peer=%d\n",
    37                  SanitizeString(msg->m_command), msg->m_message_size,
    38                  HexStr(Span<uint8_t>(hash.begin(), hash.begin() + CMessageHeader::CHECKSUM_SIZE)),
    39EOF
    
  2. fanquake referenced this in commit 87df084ecb on Jul 3, 2023
  3. fanquake referenced this in commit 1a0958eeba on Jul 3, 2023
  4. fanquake referenced this in commit c1247c3746 on Jul 3, 2023
  5. fanquake closed this on Jul 3, 2023

  6. fanquake referenced this in commit 600c595b8d on Jul 3, 2023
  7. bitcoin locked this on Jul 2, 2024


brunoerg


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me