diff options
| author | MarcoFalke <[email protected]> | 2020-03-17 13:07:36 -0400 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2020-03-17 13:07:42 -0400 |
| commit | d2d0a04a661fde731a212b0489fe211566ff5ca8 (patch) | |
| tree | 5cb19d3b260011371d56d16b6b818debfcb0fd03 /src/test/fuzz/integer.cpp | |
| parent | Merge #18364: random: remove getentropy() fallback for macOS < 10.12 (diff) | |
| parent | tests: Add fuzzing harness for various functions taking std::string as input (diff) | |
| download | discoin-d2d0a04a661fde731a212b0489fe211566ff5ca8.tar.xz discoin-d2d0a04a661fde731a212b0489fe211566ff5ca8.zip | |
Merge #18353: tests: Add fuzzing harnesses for classes CBlockHeader, CFeeRate and various functions
44abf417eb1cd8598084eee1a429ca57c7d0579a tests: Add fuzzing harness for various functions taking std::string as input (practicalswift)
d69145acb76ff12b7c5c1e55ce89e14bc6453904 tests: Add fuzzing harness for MultiplicationOverflow(...) (practicalswift)
7726f3bc4671fbc23e5bc31d0eb9fe381e2f07ef tests: Add fuzzing harness for CFeeRate (practicalswift)
0579a276307d22ae62ecbcaa704e8477274e784d tests: Add fuzzing harness for CBlockHeader (practicalswift)
cb4eec13c03089617a94169b4e30381d87788b56 tests: Add fuzzing harness for count_seconds(...) (practicalswift)
Pull request description:
Add fuzzing harnesses for classes `CBlockHeader`, `CFeeRate` and various functions.
To test this PR:
```
$ make distclean
$ ./autogen.sh
$ CC=clang CXX=clang++ ./configure --enable-fuzz \
--with-sanitizers=address,fuzzer,undefined
$ make
$ src/test/fuzz/block_header
^c (ctrl-c)
$ src/test/fuzz/fee_rate
^c (ctrl-c)
$ src/test/fuzz/integer
^c (ctrl-c)
$ src/test/fuzz/multiplication_overflow
^c (ctrl-c)
$ src/test/fuzz/string
^c (ctrl-c)
```
ACKs for top commit:
MarcoFalke:
ACK 44abf417eb1cd8598084eee1a429ca57c7d0579a 🏉
Tree-SHA512: 2b382a7bc8efdcc6dd8b79f1637f194ecdca3e522c6618ae6c4b0bf6f86d2e79b1bb1c7160522083600616d1ed509b2f577f3a512ea3a7825a0a3794578d9d90
Diffstat (limited to 'src/test/fuzz/integer.cpp')
| -rw-r--r-- | src/test/fuzz/integer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp index 980042e81..24459c21b 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 <time.h> #include <uint256.h> #include <util/moneystr.h> #include <util/strencodings.h> @@ -31,6 +32,7 @@ #include <version.h> #include <cassert> +#include <chrono> #include <limits> #include <vector> @@ -124,6 +126,8 @@ void test_one_input(const std::vector<uint8_t>& buffer) assert(parsed_money == i64); } } + const std::chrono::seconds seconds{i64}; + assert(count_seconds(seconds) == i64); const arith_uint256 au256 = UintToArith256(u256); assert(ArithToUint256(au256) == u256); |