Commit Graph
100 Commits
Author SHA1 Message Date
practicalswift e53274868e Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) 2022-04-26 10:41:45 +01:00
practicalswift 4747da3a5b Add syscall sandboxing (seccomp-bpf) 2021-10-01 13:51:10 +00:00
practicalswift 4343f114cc Replace use of locale dependent atoi(…) with locale-independent std::from_chars(…) (C++17)
test: Add test cases for LocaleIndependentAtoi

fuzz: Assert legacy atoi(s) == LocaleIndependentAtoi<int>(s)

fuzz: Assert legacy atoi64(s) == LocaleIndependentAtoi<int64_t>(s)
2021-09-30 14:21:17 +00:00
practicalswift 4747db8761 util: Introduce ToIntegral<T>(const std::string&) for locale independent parsing using std::from_chars(…) (C++17)
util: Avoid locale dependent functions strtol/strtoll/strtoul/strtoull in ParseInt32/ParseInt64/ParseUInt32/ParseUInt64

fuzz: Assert equivalence between new and old Parse{Int,Uint}{8,32,64} functions

test: Add unit tests for ToIntegral<T>(const std::string&)
2021-09-18 04:31:24 +00:00
practicalswift 696c76d660 tests: Add TrimString(...) tests 2021-09-02 13:20:08 +08:00
practicalswift 3636d9be8f Update REVIEWERS: I've found that I keep track of PRs in need of review without the need for DrahtBot's automated notification :) 2021-06-10 09:00:05 +00:00
practicalswift 37371268d1 Mark CheckTxInputs [[nodiscard]] (out-param txfee only set if call is successful). Avoid UUM in fuzzing harness coins_view. 2021-05-25 21:09:05 +00:00
practicalswift 3737d35fee fuzz: Terminate immediately if a fuzzing harness ever tries to perform a DNS lookup (belts and suspenders) 2021-05-21 19:41:43 +00:00
practicalswift 393992b049 fuzz: Terminate immediately if a fuzzing harness ever tries to create a TCP socket (belt and suspenders) 2021-05-20 19:02:37 +00:00
practicalswift 575792e6ff fuzz: Add -fsanitize=integer suppression needed for RPC fuzzer 2021-05-03 19:33:46 +00:00
practicalswift 5252f86eb6 fuzz: Reduce maintenance requirements by allowing RPC annotations also for conditionally available RPC commands (such as wallet commands) without the fragility of #ifdef forests 2021-04-29 18:40:25 +00:00
practicalswift 54549dda31 fuzz: RPC fuzzer post-merge follow-ups. Remove unused includes. Update list of fuzzed RPC commands. 2021-04-28 09:27:50 +00:00
practicalswift 545404e7e1 fuzz: Add RPC interface fuzzing. Increase fuzzing coverage from 65% to 70%. 2021-04-28 06:34:20 +00:00
practicalswift 54548bae80 net: Avoid calling getnameinfo when formatting IPv6 addresses in CNetAddr::ToStringIP 2021-04-22 15:52:14 +00:00
practicalswift c10f27fdb2 net: Make IPv6ToString do zero compression as described in RFC 5952 2021-04-22 15:53:53 +00:00
practicalswift 63631beef6 test: Remove intermittently failing and not very meaningful BOOST_CHECK in cnetaddr_basic 2021-04-15 06:19:30 +00:00
practicalswift 6262182b3f Avoid use of low file descriptor ids (which may be in use) in FuzzedSock and StaticContentsSock 2021-04-14 22:21:17 +00:00
practicalswift 585854ac66 test: Replace blanket UBSan signed integer overflow suppression for txmempool.cpp with specific suppression 2021-04-04 21:10:15 +00:00
practicalswift 58580a827d net: Avoid calling getnameinfo when formatting IPv4 addresses in CNetAddr::ToStringIP 2021-04-01 08:06:01 +00:00
practicalswift 5858057384 net: Add IPv4ToString (we already have IPv6ToString) 2021-04-01 08:00:48 +00:00
practicalswift 732c7bddeb tests: Add test for CNetAddr::ToString IPv6 address formatting (RFC 5952) 2021-03-19 21:35:56 +00:00
practicalswift 68afd3eeec tests: Add fuzzing harness for LoadMempool(...) and DumpMempool(...) 2021-03-15 15:42:15 +00:00
practicalswift 7c8c140ecc fuzz: Implement fuzzed_dns_lookup_function as lambda 2021-03-15 15:27:25 +00:00
practicalswift 91af6b97c9 validation: Make DumpMempool(...) and LoadMempool(...) easier to test/fuzz/mock 2021-03-11 22:34:39 +00:00
practicalswift af322c7494 tests: Set errno in FuzzedFileProvider. Implement seek(..., ..., SEEK_END). 2021-03-11 22:34:39 +00:00
practicalswift e528075189 tests: Add fuzzing harness for Lookup(...)/LookupHost(...)/LookupNumeric(...)/LookupSubNet(...) 2021-03-08 23:17:56 +00:00
practicalswift c6b4bfb4b3 net: Make DNS lookup code testable 2021-03-08 23:17:56 +00:00
practicalswift 3f3646855c fuzz: Avoid -Wreturn-type warnings 2021-03-04 20:29:28 +00:00
practicalswift 366e3e1f89 fuzz: Add FUZZED_SOCKET_FAKE_LATENCY mode to FuzzedSock to allow for fuzzing timeout logic 2021-03-02 21:44:51 +00:00
practicalswift b22d4c1607 fuzz: Add fuzzing harness for Socks5(...) 2021-03-02 21:43:42 +00:00
practicalswift 1f05dbd06d util: Avoid invalid integer negation in ValueFromAmount: make ValueFromAmount(const CAmount& n) well-defined also when n is std::numeric_limits<CAmount>::min() 2021-03-02 16:05:28 +00:00
practicalswift 7cc75c9ba3 util: Avoid invalid integer negation in FormatMoney: make FormatMoney(const CAmount& n) well-defined also when n is std::numeric_limits<CAmount>::min() 2021-03-02 16:05:28 +00:00
practicalswift 10d4477dae tests: Add fuzzing harness for TorController 2021-03-02 12:21:32 +00:00
practicalswift 64219c01dc torcontrol: Move TorControlReply, TorControlConnection and TorController to improve testability 2021-03-02 12:21:32 +00:00
practicalswift 25f899cc23 log: Move "Pre-allocating up to position 0x[...] in [...].dat" log message to debug category 2021-02-10 20:46:25 +00:00
practicalswift acd7980b37 log: Move "Leaving block file [...]: [...]" log message to debug category 2021-02-10 20:40:42 +00:00
practicalswift f5f2f97168 net: Avoid UBSan warning in ProcessMessage(...) 2021-02-02 08:43:19 +00:00
practicalswift dee2d6fbf9 fuzz: Avoid designated initialization (C++20) in fuzz tests 2021-01-30 08:22:32 +00:00
practicalswift f0f8b1a076 fuzz: Add UBSan suppressions needed for fuzz tests to not warn under -fsanitize=integer 2021-01-25 20:55:36 +00:00
practicalswift 58232e3ffb fuzz: Avoid -fsanitize=integer warnings in fuzzing harnesses 2021-01-25 20:55:36 +00:00
practicalswift b4511e2e2e log: Prefix log messages with function name if -logsourcelocations is set 2021-01-15 09:57:32 +00:00
practicalswift 4ddbcd0d9a fuzz: Add coverage for CDataStream consumer 2020-12-27 19:27:41 +00:00
practicalswift e3d2ba7c70 fuzz: Update FuzzedDataProvider.h from upstream (LLVM)
Upstream revision: https://github.com/llvm/llvm-project/blob/6d0488f75bb2f37bcfe93fc8f59f6e78c9a0c939/compiler-rt/include/fuzzer/FuzzedDataProvider.h

Changes:
* [compiler-rt] FuzzedDataProvider: add ConsumeData and method.
* [compiler-rt] Fix a typo in a comment in FuzzedDataProvider.h.
* [compiler-rt] Add ConsumeRandomLengthString() version without arguments.
* [compiler-rt] Refactor FuzzedDataProvider for better readability.
* [compiler-rt] FuzzedDataProvider: make linter happy.
* [compiler-rt] Mark FDP non-template methods inline to avoid ODR violations.
2020-12-21 23:19:33 +00:00
practicalswift 546a0764f3 fuzz: Fill various small fuzzing gaps 2020-12-16 14:24:16 +00:00
practicalswift 5a9ee0869b tests: Add fuzzing harness for node eviction logic 2020-12-16 13:00:47 +00:00
practicalswift fee88237e0 Assert eviction at >= 29 candidates. Assert non-eviction at <= 20 candidates. 2020-12-16 12:00:15 +00:00
practicalswift 685c428de0 test: Add unit testing of node eviction logic 2020-12-16 12:00:15 +00:00
practicalswift ed73f8cee0 net: Move eviction node selection logic to SelectNodeToEvict(...) 2020-12-16 12:00:15 +00:00
practicalswift 31b136e580 Don't declare de facto const reference variables as non-const 2020-12-06 18:44:31 +00:00
practicalswift 1c65c075ee Don't declare de facto const member functions as non-const 2020-12-06 18:44:25 +00:00
practicalswift 5021810650 Make CanFlushToDisk a const member function 2020-12-06 00:54:10 +00:00
practicalswift 281cf99554 Do not run functions with necessary side-effects in assert() 2020-12-06 00:48:09 +00:00
practicalswift 12dcdaaa54 Don't make "in" parameters look like "out"/"in-out" parameters: pass by ref to const instead of ref to non-const 2020-12-06 00:22:40 +00:00
practicalswift 8c09c0c1d1 fuzz: Avoid time-based "non-determinism" in fuzzing harnesses by using mocked GetTime() 2020-12-01 13:18:34 +00:00
practicalswift ce9dd45422 Add [[nodiscard]] to RenameOver(...) 2020-11-27 12:41:26 +00:00
practicalswift 9429a398e2 Handle rename failure in DumpMempool(...) by using RenameOver(...) return value 2020-11-27 12:41:07 +00:00
practicalswift 79bff8e48a Remove NODISCARD 2020-11-26 09:07:33 +00:00
practicalswift 4848e71107 scripted-diff: Use [[nodiscard]] (C++17) instead of NODISCARD
-BEGIN VERIFY SCRIPT-
sed -i "s/NODISCARD/[[nodiscard]]/g" $(git grep -l "NODISCARD" ":(exclude)src/bench/nanobench.h" ":(exclude)src/attributes.h")
-END VERIFY SCRIPT-
2020-11-26 09:05:59 +00:00
practicalswift fa861569dc util: Allow Assert(...) to be used in all contexts
Fixes the compile error when used inside operator[]:

./chain.h:404:23: error: C++11 only allows consecutive left square brackets when introducing an attribute
        return (*this)[Assert(pindex)->nHeight] == pindex;
                      ^
2020-11-24 09:46:49 +01:00
practicalswift 05c1095388 test: Add testing of ParseInt/ParseUInt edge cases with leading +/-/0:s 2020-11-24 08:36:48 +00:00
practicalswift 17a5f172fa fuzz: Make addrman fuzzing harness deterministic 2020-11-19 17:21:55 +00:00
practicalswift fd0be92cff doc: Add instructions on how to fuzz the P2P layer using Honggfuzz NetDriver 2020-11-12 20:20:29 +00:00
practicalswift 0ccb3addf6 tests: Remove no longer needed UBSan suppression (float-divide-by-zero in validation.cpp) 2020-11-12 18:58:59 +00:00
practicalswift d04a17a790 fuzz: Use ConsumeRandomLengthBitVector(...) in src/test/fuzz/connman and src/test/fuzz/net 2020-11-12 15:33:43 +00:00
practicalswift e6bb9fde85 tests: Add fuzzing harness for CAddrMan 2020-11-12 14:23:17 +00:00
practicalswift 3c77b8009d fuzz: Improve coverage for CPartialMerkleTree fuzzing harness 2020-11-11 22:31:40 +00:00
practicalswift ee11a412a5 Avoid signed integer overflow when loading a mempool.dat file with a malformed time field 2020-11-11 14:45:16 +00:00
practicalswift 79b8f8d574 fuzz: Assert roundtrip equality for both addrv1 and addrv2 versions of CService 2020-11-09 15:29:15 +00:00
practicalswift 0e3a78a8ab fuzz: Check for addrv1 compatibility before using addrv1 serializer/deserializer on CSubNet 2020-11-09 15:27:41 +00:00
practicalswift d7901ab8d2 fuzz: Assert expected DecodeHexTx behaviour when using legacy decoding 2020-11-04 23:11:50 +00:00
practicalswift f1f433e8ca Make it easier to reason about node eviction by removing unused NodeEvictionCandidate::addr (CAddress) 2020-11-04 12:22:06 +00:00
practicalswift 28f8cb13d4 fuzz: Fix DecodeHexTx fuzzing harness issue 2020-11-02 22:21:03 +00:00
practicalswift c2cf8a18c2 fuzz: Check for addrv1 compatibility before using addrv1 serializer on CService 2020-11-02 21:45:40 +00:00
practicalswift 903f3d0627 fuzz: Check for addrv1 compatibility before using addrv1 serializer 2020-10-26 16:37:35 +00:00
practicalswift 79ef8324d4 tests: Add fuzzing harness for CConnman 2020-10-20 06:18:54 +00:00
practicalswift 51365674e8 script: Make ComputeEntrySchnorr and ComputeEntryECDSA const to clarify contract 2020-10-16 06:26:46 +00:00
practicalswift ea93bbeb26 init: Fix incorrect warning "Reducing -maxconnections from N to N-1, because of system limitations" 2020-09-26 14:56:39 +00:00
practicalswift 9b4fa0af40 net: Print error message if -proxy is specified without arguments (instead of continuing without proxy server) 2020-09-23 15:41:49 +00:00
practicalswift f22d6a1142 log: Remove static log message "Initializing chainstate Chainstate [ibd] @ height -1 (null)" 2020-09-20 15:34:42 +00:00
practicalswift 4c189abdc4 test: add small signet fuzzer 2020-09-18 10:19:42 +09:00
practicalswift fc7f84a9ca tests: Add fuzzing harness for Keccak and SHA3_256 2020-09-10 14:54:30 +00:00
practicalswift ca185cf5a1 doc: Document differences in bitcoind and bitcoin-qt locale handling 2020-08-29 01:55:27 +00:00
practicalswift cc26fab48d tests: Add fuzzing harness for CNode 2020-08-27 17:50:39 +00:00
practicalswift 46fcac1e4b tests: Add fuzzing harness for ec_seckey_import_der(...) and ec_seckey_export_der(...) 2020-08-18 18:03:57 +00:00
practicalswift b667a90389 tests: Add fuzzing harness for SigHasLowR(...) and ecdsa_signature_parse_der_lax(...) 2020-08-18 18:03:56 +00:00
practicalswift 2f8a4c9a06 build: Enable some commonly enabled compiler diagnostics 2020-08-11 12:03:28 +00:00
practicalswift ad6c34881d tests: Add fuzzing harness for CBlockPolicyEstimator::{Read,Write} (policy/fees.h) 2020-07-15 11:41:21 +00:00
practicalswift 614e0807a8 tests: Add fuzzing harness for CBufferedFile::{SetPos,GetPos,GetType,GetVersion} (stream.h) 2020-07-15 11:41:21 +00:00
practicalswift 7bcc71e5f8 tests: Add fuzzing harness for LoadExternalBlockFile(...) (validation.h) 2020-07-15 11:41:21 +00:00
practicalswift 9823376030 tests: Add fuzzing harness for CBufferedFile (streams.h) 2020-07-15 11:41:21 +00:00
practicalswift f3aa659be6 tests: Add fuzzing harness for CAutoFile (streams.h) 2020-07-15 11:41:21 +00:00
practicalswift e507c0799d tests: Add serialization/deserialization fuzzing helpers WriteToStream(…)/ReadFromStream(…) 2020-07-15 11:41:21 +00:00
practicalswift e48094a506 tests: Add FuzzedAutoFileProvider which provides a CAutoFile interface to FuzzedDataProvider 2020-07-15 11:41:21 +00:00
practicalswift 9dbcd6854c tests: Add FuzzedFileProvider which provides a FILE* interface to FuzzedDataProvider using fopencookie 2020-07-15 11:41:21 +00:00
practicalswift 97846d7f5b tests: Add fuzzing harness for BanMan 2020-07-08 05:31:43 +00:00
practicalswift deba199f1c tests: Add ConsumeSubNet(...). Move and increase coverage in ConsumeNetAddr(...). 2020-07-08 05:05:12 +00:00
practicalswift 1087807b2b tests: Provide main(...) function in fuzzer 2020-06-25 21:03:27 +00:00
practicalswift cca7c577d5 tests: Add fuzzing harness for ChaCha20Poly1305AEAD 2020-06-25 15:06:13 +00:00
practicalswift 2fc4e5916c tests: Add fuzzing harness for ChaCha20 2020-06-25 15:06:13 +00:00
practicalswift e9e8aac029 tests: Add fuzzing harness for CHKDF_HMAC_SHA256_L32 2020-06-25 15:06:13 +00:00