bitcoin/src/rpc
MacroFake cf288377c0
Merge bitcoin/bitcoin#26275: Fix crash on deriveaddresses when index is 2147483647 (2^31-1)
9153ff3e27 rpc: add non-regression test about deriveaddresses crash when index is 2147483647 (muxator)
addf9d6502 rpc: fix crash in deriveaddresses when derivation index is 2147483647 (muxator)

Pull request description:

  This PR is a proposal for fixing #26274 (better described there).

  The problem is due to a signed int wrapping when the `index` parameter of the `deriveaddresses` RPC call has the value `2^31-1`.

  ```C++
  for (int i = range_begin; i <= range_end; ++i) {
  ```

  * the first commit adds a "temporary" test case (`test/functional/rpc_deriveaddresses_crash.py`) that shows the crash, and can be used to generate a core dump;
  * the second commit fixes the problem giving an explicit size to the `i` variable in a for loop, from `int` to `int64_t`. The same commit also removes the ephemeral test case and adds a passing test to `test/functional/rpc_deriveaddresses.py`, in order to prevent future regressions.

  This is my first submission to this project and I do not know its conventions. Please advise if something needs to be changed.

ACKs for top commit:
  achow101:
    ACK 9153ff3e27

Tree-SHA512: 0477b57b15dc2c682cf539d6002f100d44a8c7e668041aa3340c39dcdbd40e083c75dec6896b6c076b044a01c2e5254272ae6696d8a1467539391926f270940a
2022-10-26 10:12:27 +02:00
..
blockchain.cpp Merge bitcoin/bitcoin#25412: rest: add /deploymentinfo endpoint 2022-10-13 13:30:55 -04:00
blockchain.h scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
client.cpp rpc: add scanblocks - scan for relevant blocks with descriptors 2022-10-04 13:51:35 -04:00
client.h
external_signer.cpp Remove not needed clang-format off comments 2022-04-25 10:55:07 +02:00
fees.cpp rpc: remove unneeded RPCTypeCheckArgument checks 2022-09-15 10:45:18 -03:00
mempool.cpp refactor: mempool: use CTxMempool::Limits 2022-10-05 13:07:11 +01:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp Merge bitcoin/bitcoin#26118: log: Use steady clock for bench logging 2022-10-10 12:00:34 +02:00
mining.h
net.cpp Merge bitcoin/bitcoin#26109: rpc, doc: getpeerinfo updates 2022-10-13 11:07:33 -04:00
node.cpp scripted-diff: Replace NullUniValue with UniValue::VNULL 2022-07-25 17:27:53 +02:00
output_script.cpp rpc: fix crash in deriveaddresses when derivation index is 2147483647 2022-10-06 22:17:49 +02:00
protocol.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rawtransaction.cpp Merge bitcoin/bitcoin#25858: psbt: Only include PSBT_OUT_TAP_TREE when the output has a script path 2022-10-13 09:40:27 -04:00
rawtransaction_util.cpp Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid unnecessarily copying objects and enable two clang-tidy checks 2022-08-19 17:11:06 +02:00
rawtransaction_util.h rpc: Default rbf enabled 2022-07-15 11:46:34 -04:00
register.h scripted-diff: Rename rpc/misc.cpp to rpc/node.cpp 2022-05-03 09:05:15 +02:00
request.cpp Merge bitcoin/bitcoin#24675: util: Use ArgsManager::GetPathArg more widely 2022-08-04 16:58:01 +01:00
request.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server.cpp Merge bitcoin/bitcoin#26074: refactor: Set RPCArg options with designated initializers 2022-09-30 10:06:14 +02:00
server.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server_util.cpp Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
server_util.h Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
signmessage.cpp rpc: Move signmessage RPC util to new file 2022-04-28 11:19:29 +02:00
txoutproof.cpp scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
util.cpp rpc: Set RPCArg options with designated initializers 2022-09-13 18:37:15 +02:00
util.h rpc: Set RPCArg options with designated initializers 2022-09-13 18:37:15 +02:00