rpc: Fix for segfault if combinepsbt called with empty inputs #15337

pull benthecarman wants to merge 1 commits into bitcoin:master from benthecarman:rpc_combinepbst_empty_fix changing 2 files +6 −0
  1. benthecarman commented at 1:19 PM on February 4, 2019: contributor

    Fixes #15300

  2. fanquake added the label RPC/REST/ZMQ on Feb 4, 2019
  3. practicalswift commented at 3:30 PM on February 4, 2019: contributor

    Concept ACK and thanks for fixing.

    Is it worth checking if we have this problem elsewhere where we're using UniValue foo = request.params[n].get_array()

  4. benthecarman commented at 4:06 PM on February 4, 2019: contributor

    @practicalswift I did a quick pass looking for uses of get_array() and didn't find any where else that caused a crash, however some gave errors that didn't seem to correlate with what would be going wrong.

  5. in src/rpc/rawtransaction.cpp:1517 in ff918ebd2c outdated
    1513 | @@ -1514,6 +1514,9 @@ UniValue combinepsbt(const JSONRPCRequest& request)
    1514 |      // Unserialize the transactions
    1515 |      std::vector<PartiallySignedTransaction> psbtxs;
    1516 |      UniValue txs = request.params[0].get_array();
    1517 | +    if (txs.size() <= 0) {
    


    promag commented at 7:41 PM on February 4, 2019:

    if (txs.empty()) {

  6. in src/rpc/rawtransaction.cpp:1518 in ff918ebd2c outdated
    1513 | @@ -1514,6 +1514,9 @@ UniValue combinepsbt(const JSONRPCRequest& request)
    1514 |      // Unserialize the transactions
    1515 |      std::vector<PartiallySignedTransaction> psbtxs;
    1516 |      UniValue txs = request.params[0].get_array();
    1517 | +    if (txs.size() <= 0) {
    1518 | +        throw JSONRPCError(RPC_INVALID_PARAMETER, "Parameter \'txs\' cannot be empty");
    


    promag commented at 7:42 PM on February 4, 2019:

    Why \'?


    benthecarman commented at 8:27 PM on February 4, 2019:

    No particular reason, I figured it made the txs part stick out more


    practicalswift commented at 8:41 PM on February 4, 2019:

    ' doesn't have to be quoted :-)


    benthecarman commented at 8:48 PM on February 4, 2019:

    TIL

  7. rpc: Fix for segfault if combinepsbt called with empty inputs 30d0f7be6e
  8. benthecarman force-pushed on Feb 5, 2019
  9. Sjors commented at 12:39 PM on February 11, 2019: member

    tACK 30d0f7b

  10. MarcoFalke added this to the milestone 0.18.0 on Feb 11, 2019
  11. MarcoFalke merged this on Feb 11, 2019
  12. MarcoFalke closed this on Feb 11, 2019

  13. MarcoFalke referenced this in commit e84e0d4b5e on Feb 11, 2019
  14. benthecarman deleted the branch on Feb 11, 2019
  15. deadalnix referenced this in commit 18b7c86119 on Jun 15, 2020
  16. ftrader referenced this in commit fad5d8f467 on Aug 17, 2020
  17. linuxsh2 referenced this in commit 457ea759a2 on Jul 30, 2021
  18. linuxsh2 referenced this in commit 8ce5b6b099 on Aug 3, 2021
  19. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me