diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-04-07 16:32:00 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-04-08 14:45:27 +0000 |
commit | 2df5701e902effa93834d9520690cbaca7e504f3 (patch) | |
tree | 7221a99d32c9eac97d985cd3be0edac8a1705d09 /src | |
parent | 7b9a2dc86426926038b2f49d3d4ce4cb64dcd14b (diff) |
tests: Add coverage of GetVirtualTransactionSize(...) to existing fuzzer
Diffstat (limited to 'src')
-rw-r--r-- | src/test/fuzz/integer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp index fff2fabd17..f3259f6598 100644 --- a/src/test/fuzz/integer.cpp +++ b/src/test/fuzz/integer.cpp @@ -23,6 +23,7 @@ #include <streams.h> #include <test/fuzz/FuzzedDataProvider.h> #include <test/fuzz/fuzz.h> +#include <test/fuzz/util.h> #include <time.h> #include <uint256.h> #include <util/moneystr.h> @@ -90,8 +91,12 @@ void test_one_input(const std::vector<uint8_t>& buffer) } (void)GetSizeOfCompactSize(u64); (void)GetSpecialScriptSize(u32); - // (void)GetVirtualTransactionSize(i64, i64); // function defined only for a subset of int64_t inputs - // (void)GetVirtualTransactionSize(i64, i64, u32); // function defined only for a subset of int64_t/uint32_t inputs + if (!MultiplicationOverflow(i64, static_cast<int64_t>(::nBytesPerSigOp)) && !AdditionOverflow(i64 * ::nBytesPerSigOp, static_cast<int64_t>(4))) { + (void)GetVirtualTransactionSize(i64, i64); + } + if (!MultiplicationOverflow(i64, static_cast<int64_t>(u32)) && !AdditionOverflow(i64, static_cast<int64_t>(4)) && !AdditionOverflow(i64 * u32, static_cast<int64_t>(4))) { + (void)GetVirtualTransactionSize(i64, i64, u32); + } (void)HexDigit(ch); (void)MoneyRange(i64); (void)ToString(i64); |