Skip to content

Commit fdceb63

Browse files
fuzz: Remove enumeration of expected deserialization exceptions in ProcessMessage(...) fuzzer
1 parent 85bae24 commit fdceb63

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/test/fuzz/process_message.cpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@
1919
#include <validationinterface.h>
2020
#include <version.h>
2121

22-
#include <algorithm>
2322
#include <atomic>
2423
#include <cassert>
2524
#include <chrono>
2625
#include <cstdint>
2726
#include <iosfwd>
2827
#include <iostream>
29-
#include <map>
3028
#include <memory>
31-
#include <set>
3229
#include <string>
3330
#include <vector>
3431

@@ -44,19 +41,6 @@ const std::string LIMIT_TO_MESSAGE_TYPE{TO_STRING(MESSAGE_TYPE)};
4441
const std::string LIMIT_TO_MESSAGE_TYPE;
4542
#endif
4643

47-
const std::map<std::string, std::set<std::string>> EXPECTED_DESERIALIZATION_EXCEPTIONS = {
48-
{"CDataStream::read(): end of data: iostream error", {"addr", "block", "blocktxn", "cmpctblock", "feefilter", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "ping", "sendcmpct", "tx"}},
49-
{"CompactSize exceeds limit of type: iostream error", {"cmpctblock"}},
50-
{"differential value overflow: iostream error", {"getblocktxn"}},
51-
{"index overflowed 16 bits: iostream error", {"getblocktxn"}},
52-
{"index overflowed 16-bits: iostream error", {"cmpctblock"}},
53-
{"indexes overflowed 16 bits: iostream error", {"getblocktxn"}},
54-
{"non-canonical ReadCompactSize(): iostream error", {"addr", "block", "blocktxn", "cmpctblock", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "tx"}},
55-
{"ReadCompactSize(): size too large: iostream error", {"addr", "block", "blocktxn", "cmpctblock", "filteradd", "filterload", "getblocks", "getblocktxn", "getdata", "getheaders", "headers", "inv", "notfound", "tx"}},
56-
{"Superfluous witness record: iostream error", {"block", "blocktxn", "cmpctblock", "tx"}},
57-
{"Unknown transaction optional data: iostream error", {"block", "blocktxn", "cmpctblock", "tx"}},
58-
};
59-
6044
const TestingSetup* g_setup;
6145
} // namespace
6246

@@ -91,13 +75,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
9175
g_setup->m_node.peer_logic->InitializeNode(&p2p_node);
9276
try {
9377
(void)ProcessMessage(&p2p_node, random_message_type, random_bytes_data_stream, GetTimeMillis(), Params(), *g_setup->m_node.mempool, g_setup->m_node.connman.get(), g_setup->m_node.banman.get(), std::atomic<bool>{false});
94-
} catch (const std::ios_base::failure& e) {
95-
const std::string exception_message{e.what()};
96-
const auto p = EXPECTED_DESERIALIZATION_EXCEPTIONS.find(exception_message);
97-
if (p == EXPECTED_DESERIALIZATION_EXCEPTIONS.cend() || p->second.count(random_message_type) == 0) {
98-
std::cout << "Unexpected exception when processing message type \"" << random_message_type << "\": " << exception_message << std::endl;
99-
assert(false);
100-
}
78+
} catch (const std::ios_base::failure&) {
10179
}
10280
SyncWithValidationInterfaceQueue();
10381
}

0 commit comments

Comments
 (0)