aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-17 08:43:12 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-17 08:43:16 +0100
commit7de2cf9b258590ffefd724abe0d4458f282b95c3 (patch)
tree93516891faf743b17979075e63ce628fb091d605 /src/test
parent4a062508b73dd25c4859a3c56c2afaba149985db (diff)
parentfa7238300c18938cdf627cacfc58d4b81602417f (diff)
downloadbitcoin-7de2cf9b258590ffefd724abe0d4458f282b95c3.tar.xz
Merge bitcoin/bitcoin#23992: fuzz: Limit fuzzed time to years 2000-2100
fa7238300c18938cdf627cacfc58d4b81602417f fuzz: Limit fuzzed time to years 2000-2100 (MarcoFalke) Pull request description: It doesn't make sense to fuzz times in the past, as Bitcoin Core will refuse to start in the past. Fix that and also remove a sanitizer suppression, which would be hit in net_processing in `ProcessMessage`: ```cpp if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) addr.nTime = nNow - 5 * 24 * 60 * 60; // <-- Here ``` This changes the format of fuzz inputs. Previously a time value was (de)serialized as 40 bytes, now it is 32 bytes. ACKs for top commit: mzumsande: Code Review ACK fa7238300c18938cdf627cacfc58d4b81602417f Tree-SHA512: ca6e7233beec2d9ef9fd481d8f1331942a4d2c8fe518b857629bebcc53a4f42ae123b994cf5d359384a0a8022098ff5a9c146600bc2593c6d88734e25bc240ad
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/util.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/fuzz/util.cpp b/src/test/fuzz/util.cpp
index f89b597eed..47c2be3faa 100644
--- a/src/test/fuzz/util.cpp
+++ b/src/test/fuzz/util.cpp
@@ -281,8 +281,8 @@ CAmount ConsumeMoney(FuzzedDataProvider& fuzzed_data_provider, const std::option
int64_t ConsumeTime(FuzzedDataProvider& fuzzed_data_provider, const std::optional<int64_t>& min, const std::optional<int64_t>& max) noexcept
{
// Avoid t=0 (1970-01-01T00:00:00Z) since SetMockTime(0) disables mocktime.
- static const int64_t time_min = ParseISO8601DateTime("1970-01-01T00:00:01Z");
- static const int64_t time_max = ParseISO8601DateTime("9999-12-31T23:59:59Z");
+ static const int64_t time_min{ParseISO8601DateTime("2000-01-01T00:00:01Z")};
+ static const int64_t time_max{ParseISO8601DateTime("2100-12-31T23:59:59Z")};
return fuzzed_data_provider.ConsumeIntegralInRange<int64_t>(min.value_or(time_min), max.value_or(time_max));
}