aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-08Merge #18565: tests: Add fuzzing harnesses for classes/functions in ā†µMarcoFalke
policy/fees.h, checkqueue.h and cuckoocache.h. Add fuzzing coverage. 283bd72156959f420f13acc7a34e513ca3446025 tests: Add coverage of {,Incremental}DynamicUsage(const std::set<X, Y>& s) to existing fuzzer (practicalswift) bf76000493082da05bf7258a5038e16fa76cd143 tests: Add fuzzing harness for classes/functions in cuckoocache.h (practicalswift) 57890b2555ca347373109052f6789c23f46bc594 tests: Add fuzzing harness for classes/functions in checkqueue.h (practicalswift) 2df5701e902effa93834d9520690cbaca7e504f3 tests: Add coverage of GetVirtualTransactionSize(...) to existing fuzzer (practicalswift) 7b9a2dc86426926038b2f49d3d4ce4cb64dcd14b tests: Add fuzzing harness for AdditionOverflow(...) (practicalswift) 44fb2a596b4a1aa70253c4145c35be6de68da22a tests: Add fuzzing harness for FeeFilterRounder (practicalswift) Pull request description: Includes: ``` tests: Add fuzzing harness for FeeFilterRounder tests: Add fuzzing harness for classes/functions in checkqueue.h tests: Add fuzzing harness for classes/functions in cuckoocache.h tests: Add coverage of {,Incremental}DynamicUsage(const std::set<X, Y>& s) to existing fuzzer tests: Add coverage of GetVirtualTransactionSize(...) to existing fuzzer tests: Add fuzzing harness for AdditionOverflow(...) ``` See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. ACKs for top commit: MarcoFalke: ACK 283bd72156959f420f13acc7a34e513ca3446025 Tree-SHA512: 2361edfb5c47741b22d9fb996836c5250c5a26bc5e956039ea6a0c55ba2d36c78f241d66f85bc02f5b85b9b83d5fde56a5c4702b9d1b7ac4a9a3ae391ca79eaa
2020-04-08Merge #18563: test: Fix unregister_all_during_call cleanupMarcoFalke
13d2a33537a403ac47a989be92109d3214375b6a Fix unregister_all_during_call cleanup (Russell Yanofsky) Pull request description: Use `TestingSetup` fixture to fix `unregister_all_during_call` test not calling `UnregisterBackgroundSignalScheduler`, which could trigger an assert in `RegisterBackgroundSignalScheduler` when called in later tests Failure reported by fanquake https://github.com/bitcoin/bitcoin/pull/18551#issuecomment-610974251 ACKs for top commit: MarcoFalke: ACK 13d2a33537a403ac47a989be92109d3214375b6a if appveyor unit tests pass Tree-SHA512: d2ec8ff14c54d97903af50031abfac1f38ec1c3aabc90371cfd5b79481fa69d3d77f339bfdf7d2178fd85e83402f72eda7cf4d339e5bbfa7e6e1a68836643b93
2020-04-08tests: Add coverage of {,Incremental}DynamicUsage(const std::set<X, Y>& s) ā†µpracticalswift
to existing fuzzer
2020-04-08tests: Add fuzzing harness for classes/functions in cuckoocache.hpracticalswift
2020-04-08tests: Add fuzzing harness for classes/functions in checkqueue.hpracticalswift
2020-04-08tests: Add coverage of GetVirtualTransactionSize(...) to existing fuzzerpracticalswift
2020-04-08tests: Add fuzzing harness for AdditionOverflow(...)practicalswift
2020-04-08tests: Add fuzzing harness for FeeFilterRounderpracticalswift
2020-04-08Merge #18558: build: Fix boost detection for arch armv7lWladimir J. van der Laan
da0842dcd44f8c9c9b167917fac0949b4978c3b0 build: Update ax_boost_mase.m4 to the latest serial (Hennadii Stepanov) Pull request description: Picked from the upstream https://github.com/autoconf-archive/autoconf-archive/commit/90814f1895435ee3aa077e0880bd6aa49bf14ec3 Fix #17010. This PR is [alternative](https://github.com/bitcoin/bitcoin/issues/17010#issuecomment-610651736) to #18501. ACKs for top commit: laanwj: ACK da0842dcd44f8c9c9b167917fac0949b4978c3b0 Tree-SHA512: 5e43e12c524e4ea6b967c9be02c81a75948eac6cf55b819e3339222a2e3414731581d40af3524ad865abae7c5247c190448ebf2aa5e0d9a338edb501cc23ba38
2020-04-08ci: Run unit tests sequential onceMarcoFalke
2020-04-08appveyor: Enable minimal unit test logging to aid debuggingMarcoFalke
2020-04-08Fix unregister_all_during_call cleanupRussell Yanofsky
Use TestingSetup fixture to fix unregister_all_during_call test not calling UnregisterBackgroundSignalScheduler, which could trigger an assert in RegisterBackgroundSignalScheduler when called in later tests Failure reported by fanquake <fanquake@gmail.com> https://github.com/bitcoin/bitcoin/pull/18551#issuecomment-610974251
2020-04-08test: Properly raise FailedToStartError when rpc shutdown before warmup finishedMarcoFalke
2020-04-08build: Update ax_boost_mase.m4 to the latest serialHennadii Stepanov
This change fixes boost detection for arch armv7l.
2020-04-08Merge #18551: Do not clear validationinterface entries being executedMarcoFalke
2276339a176f83ffe8ceefb3e41ecca8601aa13b Add test for UnregisterAllValidationInterfaces bug (Russell Yanofsky) 3c61abbbc847d725f30d169278d84655571407c1 Do not clear validationinterface entries being executed (Pieter Wuille) Pull request description: The previous code for MainSignalsInstance::Clear would decrement the reference count of every interface, including ones that were already Unregister()ed but still being executed. This fixes the issue pointed out here: https://github.com/bitcoin/bitcoin/pull/18524/files#r404395685 . It's not currently observable. ACKs for top commit: jonasschnelli: utACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b - reviewed code and test (thanks @ryanofsky for adding the test). MarcoFalke: ACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b šŸŽŽ ryanofsky: Code review ACK 2276339a176f83ffe8ceefb3e41ecca8601aa13b. No change to bugfix, just rebased and new test commit added since last review Tree-SHA512: c1d68e7c681a45c6cadc84e407c2266bcb4b12d34264e1232a61c4eadb74b551231c5a3b1d041de39f507aef4dfa7d4589b8bfe1833f069c739c6270d2a05dbe
2020-04-07Add test for UnregisterAllValidationInterfaces bugRussell Yanofsky
Bug in MainSignalsInstance::Clear could cause validation interface callbacks to be deleted during execution if UnregisterAllValidationInterfaces was called more than once. Bug was introduced in https://github.com/bitcoin/bitcoin/pull/18524 and is fixed by https://github.com/bitcoin/bitcoin/pull/18551
2020-04-07Do not clear validationinterface entries being executedPieter Wuille
The previous code for MainSignalsInstance::Clear would decrement the reference count of every interface, including ones that were already Unregister()ed but still being executed.
2020-04-07Merge #18532: rpc: Avoid initialization-order-fiasco on static CRPCCommand ā†µMarcoFalke
tables fa1a92224dd78de817d15bcda35a8310254e1a54 rpc: Avoid initialization-order-fiasco on static CRPCCommand tables (MarcoFalke) Pull request description: Currently the fiasco is only theoretical because all content of the table are compile-time constants. However, the fiasco materializes should they ever become run-time constants (e.g. #18531). ACKs for top commit: promag: ACK fa1a92224dd78de817d15bcda35a8310254e1a54. practicalswift: ACK fa1a92224dd78de817d15bcda35a8310254e1a54 -- fiasco bad :) Tree-SHA512: cccadb0ad56194599b74f04264d74c34fa865958580a850efc6474bbdc56f30cadce6b2e9a6ad5472ff46c3f4c793366acd8090fad409a45b25d961f2d89da19
2020-04-07Merge #18546: Bugfix: Wallet: Safely deal with change in the address book ā†µMarcoFalke
[part 2] 7a2ecf16df938dd95d3130a46082def7a02338eb Wallet: Change IsMine check in CWallet::DelAddressBook from assert to failure (Luke Dashjr) 2952c46b923042f2de801f319e03ed5c4c4eb735 Wallet: Replace CAddressBookData.name with GetLabel() method (Luke Dashjr) d7092c392e10889cd7a080b3d22ed6446a59b87a QA: Test that change doesn't turn into non-change when spent in an avoid-reuse wallet (Luke Dashjr) Pull request description: Follow-up to #18192, not strictly necessary for 0.20 ACKs for top commit: MarcoFalke: re-ACK 7a2ecf16df, only change is adding an assert_equal in the test šŸ”° jnewbery: utACK 7a2ecf16df938dd95d3130a46082def7a02338eb Tree-SHA512: e0933ee40f705b751697dc27249e1868ed4874254b174ebdd0a7150125d8c818402e66df2371718c7eeb90e67ee2317215fb260aa9b9d7b9b45ee436de2988ff
2020-04-07Merge #18549: qt: Fix Window -> Minimize menu itemMarcoFalke
56fe839e4e6d837b95b920a524570d11f7c3c5ce qt: Fix Window -> Minimize menu item (Hennadii Stepanov) Pull request description: Now Window -> Minimize menu item is broken on Linux. Steps to reproduce: 1. start `bitcoin-qt` 2. activate Window -> Minimize menu item with a keyboard (not by a shortcut) or a mouse **Expected behavior** The main window gets minimized. **Actual behavior** The main window still unchanged. Even worse: the menu widget becomes a separate window: ![Screenshot from 2020-04-07 00-32-02](https://user-images.githubusercontent.com/32963518/78608129-ffb1dd80-7868-11ea-8e73-62ecc140ac1f.png) This PR does not touch the macOS specific code as `qApp->focusWindow()` seems work on macOS flawlessly. ACKs for top commit: promag: Tested ACK 56fe839e4e6d837b95b920a524570d11f7c3c5ce on bionic with qt 5.9.5. Tree-SHA512: 3582e44ba181d859f5994b9cddc6ce1b60aa1db520a31dd3a0684336c79d558d7410ce7a1ab5b0860c6431b54d8acc3aa16e399717b4c70839861e6b6c4290c0
2020-04-06Reorder the test instructions by numberPieter Wuille
2020-04-06Merge and generalize case 3 and case 6Pieter Wuille
2020-04-06Only run sanity check once at the endPieter Wuille
2020-04-06Assert immediately rather than caching failurePieter Wuille
2020-04-06Make a fuzzer-based copy of the prevector randomized testPieter Wuille
2020-04-07qt: Fix Window -> Minimize menu itemHennadii Stepanov
2020-04-06Wallet: Change IsMine check in CWallet::DelAddressBook from assert to failureLuke Dashjr
2020-04-06Wallet: Replace CAddressBookData.name with GetLabel() methodLuke Dashjr
2020-04-06QA: Test that change doesn't turn into non-change when spent in an ā†µLuke Dashjr
avoid-reuse wallet
2020-04-07Merge #18543: test: Use one node to avoid a race due to missing sync in ā†µMarcoFalke
rpc_signrawtransaction fa2251df5e3471e0d19d5d5c7780d34ee1498cee test: Use one node to avoid a race due to missing sync in rpc_signrawtransaction (MarcoFalke) Pull request description: Node 0 creates a transaction in a block, and node 1 sends a spending transaction without properly syncing the utxo set. Fixes intermittent test failure in rpc_signrawtransaction ``` test 2020-04-01T00:14:03.400000Z TestFramework (ERROR): JSONRPC error Traceback (most recent call last): File "C:\projects\bitcoin\test\functional\test_framework\test_framework.py", line 112, in main self.run_test() File "C:\projects\bitcoin/test/functional/rpc_signrawtransaction.py", line 213, in run_test self.witness_script_test() File "C:\projects\bitcoin/test/functional/rpc_signrawtransaction.py", line 208, in witness_script_test self.nodes[1].sendrawtransaction(spending_tx_signed['hex']) File "C:\projects\bitcoin\test\functional\test_framework\coverage.py", line 47, in __call__ return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs) File "C:\projects\bitcoin\test\functional\test_framework\authproxy.py", line 141, in __call__ raise JSONRPCException(response['error'], status) test_framework.authproxy.JSONRPCException: bad-txns-inputs-missingorspent (-25) ``` Full log: https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/31864368 ACKs for top commit: achow101: ACK fa2251df5e3471e0d19d5d5c7780d34ee1498cee Tree-SHA512: 9450d216d9989d6c44028ae4b9818790cfb00796e0de22331422f775f74d697bb14ebae0e88dca20c6b641363780da384fe94c708e20fce9cfde929fb343b12f
2020-04-07Merge #18192: Bugfix: Wallet: Safely deal with change in the address bookMarcoFalke
b5795a788639305bab86a8b3f6b75d6ce81be083 Wallet: Add warning comments and assert to CWallet::DelAddressBook (Luke Dashjr) 6d2905f57aaeb3ec3b63d31043f7673ca10003f2 Wallet: Avoid unnecessary/redundant m_address_book lookups (Luke Dashjr) c751d886f499257627b308b11ffaa51c22db6cc0 Wallet: Avoid treating change-in-the-addressbook as non-change everywhere (Luke Dashjr) 8e64b8c84bcbd63caea06f3af087af1f0609eaf5 Wallet: New FindAddressBookEntry method to filter out change entries (and skip ->second everywhere) (Luke Dashjr) 65b6bdc2b164343ec3cc3d32a0297daff9e24fec Wallet: Add CAddressBookData::IsChange which returns true iff label has never been set (Luke Dashjr) 144b2f85da4d51bf7d72b987888ddcaf5b429eed Wallet: Require usage of new CAddressBookData::setLabel to change label (Luke Dashjr) b86cd155f6f661052042048aa7cfc2a397afe4f7 scripted-diff: Wallet: Rename mapAddressBook to m_address_book (Luke Dashjr) Pull request description: In many places, our code assumes that presence in the address book indicates a non-change key, and absence of an entry in mapAddressBook indicates change. This no longer holds true after #13756 (first released in 0.19) since it added a "used" DestData populated even for change addresses. Only avoid-reuse wallets should be affected by this issue. Thankfully, populating DestData does not write a label to the database, so we can retroactively fix this (so long as the user didn't see the change address and manually assign it a real label). Fixing it is accomplished by: * Adding a new bool to CAddressBookData to track if the label has ever been assigned, either by loading one from the database, or by assigning one at runtime. * `CAddressBookData::IsChange` and `CWallet::FindAddressBookEntry` are new methods to assist in excluding change from code that doesn't expect to see them. * For safety in merging, `CAddressBookData::name` has been made read-only (the actual data is stored in `m_label`, a new private member, and can be changed only with `setLabel` which updates the `m_change` flag), and `mapAddressBook` has been renamed to `m_address_book` (to force old code to be rebased to compile). A final commit also does some minor optimisation, avoiding redundant lookups in `m_address_book` when we already have a pointer to the `CAddressBookData`. ACKs for top commit: ryanofsky: Code review ACK b5795a788639305bab86a8b3f6b75d6ce81be083. Pretty clever and nicely implemented fix! jonatack: ACK b5795a788639305bab86a8b3f6b75d6ce81be083 nice improvements -- code review, built/ran tests rebased on current master ff53433fe4ed06893d7c4 and tested manually with rpc/cli jnewbery: Good fix. utACK b5795a788. Tree-SHA512: 40525185a0bcc1723f602243c269499ec86ecb298fecb5ef24d626bbdd5e3efece86cdb1084ad7eebf7eeaf251db4a6e056bcd25bc8457b417fcbb53d032ebf0
2020-04-06Merge #18458: net: Add missing cs_vNodes lockWladimir J. van der Laan
fa369651c5523f393e0bfcfa328b8e27006711aa net: Add missing cs_vNodes lock (MarcoFalke) Pull request description: Fixes #18457 ACKs for top commit: promag: Code review ACK fa369651c5523f393e0bfcfa328b8e27006711aa. laanwj: ACK fa369651c5523f393e0bfcfa328b8e27006711aa Tree-SHA512: 60d7000f2f3d480bb0953ce27a0020763e7102da16a0006b619e0a236cfc33cbd4f83d870e9f0546639711cd877c1f9808d419184bbc153bb328885417e0066c
2020-04-06Merge #18487: rpc: Fix rpcRunLater race in walletpassphraseWladimir J. van der Laan
7b8e15728d1ad058a4b7d7569fd5d5ba6806ca28 rpc: Fix rpcRunLater race in walletpassphrase (JoĆ£o Barbosa) Pull request description: Release locks before calling `rpcRunLater`. Quick explanation: `rpcRunLater` leads to `event_free` which calls `event_del` which can wait for the event callback to finish if it's already running and that callback will try to lock wallet mutex - which is already locked in http thread. Fixes #14995 , fixes #18482. Best reviewed with whitespace changes hidden. ACKs for top commit: MarcoFalke: ACK 7b8e15728d, only tested that this avoids the node freezing. Did not look at how libevent works or how the deadlock happens or if this breaks other stuff. šŸ“ž ryanofsky: Code review ACK 7b8e15728d1ad058a4b7d7569fd5d5ba6806ca28. Just updated comment since last review Tree-SHA512: 17874a2fa7b0e164fb0d7ee4cb7d59650275b8c03476fb291d60af8b758495457660d3912623fb26259fefe84aeba21c0a9e0c6467982ba511f19344ed5413ab
2020-04-07Merge #18540: test: wallet_bumpfee assertion fixupMarcoFalke
b224b4e7bd8c52bb70d933c1bc524c0fe87ac0c1 test: wallet_bumpfee assertion fixup (Jon Atack) Pull request description: Follow-up to #18516 to fix up an assertion as per suggested change in https://github.com/bitcoin/bitcoin/pull/18516#discussion_r404191587. ACKs for top commit: jnewbery: ACK b224b4e7bd8c52bb70d933c1bc524c0fe87ac0c1 Tree-SHA512: 4973bba73a67c1ffaf460921b3d454e9d66a40a67f73b7df742e24a0e389adba3946a3958a729391ee6bfa4ef844be759ebf71d14d788434c248e48a2bbe5bde
2020-04-07test: Use one node to avoid a race due to missing sync in rpc_signrawtransactionMarcoFalke
2020-04-07Merge #18484: rpc: Correctly compute redeemScript from witnessScript for ā†µMarcoFalke
signrawtransaction cd3b1569d9ad8e24d3a222aff74e0c254baadf79 Correctly compute redeemScript from witnessScript for signrawtransaction (Andrew Chow) Pull request description: `ParsePrevouts` uses `GetScriptForWitness` on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a `WitnessV0ScriptHash` destination and get the script for that. Test cases are also added. These will fail on master with a `redeemScript does not correspond to witnessScript` Reported on [Bitcointalk](https://bitcointalk.org/index.php?topic=5236818.0) ACKs for top commit: MarcoFalke: weak ACK cd3b1569d9, only checked that the test fails without the code change šŸš° instagibbs: utACK https://github.com/bitcoin/bitcoin/pull/18484/commits/cd3b1569d9ad8e24d3a222aff74e0c254baadf79 Tree-SHA512: afac671dbb52ce88bfb4a9ca3dd6065427ad52c9778d0549ad40e9286778f308adad24fb3b3c3089545d7f88c57c53d41224fd7a4bb207550eff2fe06600118f
2020-04-07rpc: Make verifychain default values static, not depend on global argsMarcoFalke
2020-04-06test: wallet_bumpfee assertion fixupJon Atack
2020-04-06Merge #18516: test: relax bumpfee dust_to_fee txsize an extra vbyteMarcoFalke
25e03ba1ff18ca06954786e512000648941b4dfb test: relax bumpfee dust_to_fee txsize an extra vbyte (Jon Atack) Pull request description: Hopefully closes #18511 by allowing the transaction size to be 140-141 vbytes rather than strictly 141, and bumps with a slightly larger fee to ensure dust in the 140 vbyte case. ACKs for top commit: jnewbery: utACK 25e03ba1ff18ca06954786e512000648941b4dfb Tree-SHA512: 76a04e1ce090e48befe048ed6d412222d7f8bc951ff822850833061a0606b1bebc5289f7249737d3fb9aa26eb857f99543981037cea6babe3e578e2cfe8afcdb
2020-04-06test: relax bumpfee dust_to_fee txsize an extra vbyteJon Atack
and add explanatory documentation for the reasoning.
2020-04-06Merge #18524: refactor: drop boost::signals2 in validationinterfaceWladimir J. van der Laan
d6815a2313158862d448733954a73520f223deb6 refactor: drop boost::signals2 in validationinterface (Russell Yanofsky) Pull request description: Stop using boost::signals2 internally in validationinterface. Replace with std::list and Add/Remove/Clear/Iterate helper functions. Motivation for change is to reduce dependencies and avoid issues happening with boost versions before 1.59: https://github.com/bitcoin/bitcoin/issues/18517, https://github.com/bitcoin/bitcoin/pull/18471 ACKs for top commit: MarcoFalke: ACK d6815a2313158862d448733954a73520f223deb6 laanwj: ACK d6815a2313158862d448733954a73520f223deb6 hebasto: re-ACK d6815a2313158862d448733954a73520f223deb6 promag: ACK d6815a2313158862d448733954a73520f223deb6. Tree-SHA512: 4fc0f14a8446e8616cc142af6c3d36815f3254525d30348ba8e4d4bc74c249a5a8c9bc119bdd1be7ebd7abe0b784bc0c5551a3e156a766890cb2fdd891a95919
2020-04-06Remove PID file at the very endHennadii Stepanov
2020-04-06tests: Add fuzzing harness for HTTPRequest, libevent's evhttp and related ā†µpracticalswift
functions
2020-04-06Merge #18534: test: skip backwards compat tests if not compiled with walletMarcoFalke
c0c43ae1471347ea93614e9a25989f13b021f8a8 test: skip backwards compat tests if not compiled with wallet (fanquake) Pull request description: Top commit has no ACKs. Tree-SHA512: d9975a1490e69134408b6b724cea26a6c1397d43f59850283b9e338ae38e00fefbcd868fb141e0a4bb55f02076690a99331f29cfa2d0fa66c165032b24a94081
2020-04-06Merge #18506: net: Hardcoded seeds update for 0.20Wladimir J. van der Laan
0eeb0468e7debb1dbe38242769207d22ed52c1df net: Hardcoded seeds update for 0.20 (Wladimir J. van der Laan) Pull request description: Update hardcoded seeds from http://bitcoin.sipa.be/seeds.txt.gz, according to release process. Output from makeseeds.py: ``` IPv4 IPv6 Onion Pass 1364173 244127 2454 Initial 1364173 244127 2454 Skip entries with invalid address 1129552 213117 2345 After removing duplicates 1129548 213117 2345 Skip entries from suspicious hosts 338216 191944 2249 Enforce minimal number of blocks 336851 188993 2189 Require service bit 1 6998 1520 150 Require minimum uptime 5682 1290 89 Require a known and recent user agent 5622 1279 89 Filter out hosts with multiple bitcoin ports 512 146 89 Look up ASNs and limit results per ASN and per net ``` Top commit has no ACKs. Tree-SHA512: ce1c2cda18dd5bd22586a5283a0877f3bd890437cc29dc1d85452ba4a4d28032f591c8b37f3329e8e649556cf83750b6949a068fad76d1773853d93014609da0
2020-04-06Merge #18514: test: remove rapidcheck integration and testsfanquake
9e071b00898aedd9632f105a22d976dc6dbc84b1 test: remove rapidcheck integration and tests (fanquake) Pull request description: Whilst the property tests are interesting, ultimately [rapidcheck](https://github.com/emil-e/rapidcheck) integration in this repository has not gained much traction. We have a limited number of tests, and they are rarely (if ever) run. Have discussed this with Chris Stewart. ACKs for top commit: practicalswift: ACK 9e071b00898aedd9632f105a22d976dc6dbc84b1 Tree-SHA512: d0c12af3163382eee8413da420c63e39265a7b700709a05d518445832d45e049aed9508e32524db5228fe3ac114609a00b7bb890be047c07032e44a5ef4611e9
2020-04-06test: skip backwards compat tests if not compiled with walletfanquake
2020-04-06scripted-diff: Replace strCommand with msg_typeMarcoFalke
-BEGIN VERIFY SCRIPT- sed -i 's/\<strCommand\>/msg_type/g' ./src/net_processing.cpp ./src/test/fuzz/process_message.cpp -END VERIFY SCRIPT-
2020-04-06rpc: Avoid initialization-order-fiasco on static CRPCCommand tablesMarcoFalke
2020-04-05Merge #18515: test: add BIP37 remote crash bug [CVE-2013-5700] test to ā†µMarcoFalke
p2p_filter.py 0ed2d8e07d3806d78d03a77d2153f22f9d733a07 test: add BIP37 remote crash bug [CVE-2013-5700] test to p2p_filter.py (Sebastian Falbesoner) Pull request description: Integrates the missing message type `filteradd` to the test framework and checks that the BIP37 implementation is not vulnerable to the "remote crash bug" [CVE-2013-5700](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-5700) anymore. Prior to v.0.8.4, it was possible to trigger a division-by-zero error on the following line in the function `CBloomFilter::Hash()`: https://github.com/bitcoin/bitcoin/blob/f0d6487e290761a4fb03798240a351b5fddfdb38/src/bloom.cpp#L45 By setting a zero-length filter via `filterload`, `vData.size()` is 0, so the modulo operation above, called on any .insert() or .contains() operation then crashed the node. The test uses the approach of just sending an arbitrary `filteradd` message after, which calls `CBloomFilter::insert()` (and in turn `CBloomFilter::Hash()`) on the node. The vulnerability was fixed by commit https://github.com/bitcoin/bitcoin/commit/37c6389c5a0ca63ae3573440ecdfe95d28ad8f07 (an intentional covert fix, [according to gmaxwell](https://github.com/bitcoin/bitcoin/issues/18483#issuecomment-608224095)), which introduced flags `isEmpty`/`isFull` that wouldn't call the `Hash()` member function if `isFull` is true (set to true by default constructor). To validate that the test fails if the implementation is vulnerable, one can simply set the flags to false in the member function `UpdateEmptyFull()` (that is called after a filter received via `filterload` is constructed), which activates the vulnerable code path calling `Hash` in any case on adding or testing for data in the filter: ```diff diff --git a/src/bloom.cpp b/src/bloom.cpp index bd6069b..ef294a3 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -199,8 +199,8 @@ void CBloomFilter::UpdateEmptyFull() full &= vData[i] == 0xff; empty &= vData[i] == 0; } - isFull = full; - isEmpty = empty; + isFull = false; + isEmpty = false; } ``` Resulting in: ``` $ ./p2p_filter.py [...] 2020-04-03T14:38:59.593000Z TestFramework (INFO): Check that division-by-zero remote crash bug [CVE-2013-5700] is fixed 2020-04-03T14:38:59.695000Z TestFramework (ERROR): Assertion failed [...] [... some exceptions following ...] ``` ACKs for top commit: naumenkogs: utACK 0ed2d8e07d3806d78d03a77d2153f22f9d733a07 Tree-SHA512: 02d0253d13eab70c4bd007b0750c56a5a92d05d419d53033523eeb3ed80318bc95196ab90f7745ea3ac9ebae7caee3adbf2a055a40a4124e0915226e49018fe8