Fix crash in fundrawtransaction when using non-solvable scripts #14402

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2018/10/frt_watch_fix changing 1 files +6 −1
  1. jonasschnelli commented at 8:26 AM on October 5, 2018: contributor

    CreateTransaction() with non-solvable inputs (example: import a P2SH script) are leading to a crash.

    CalculateMaximumSignedInputSize(change_prototype_txout, this); can return -1 in case of non-solvable input which gets directly loaded into a size_t container CoinSelectionParams::change_spend_size resulting to overflow back to size_t::max.

    This should correctly detect the non-solvability and return an error.

    A commit (to pull in here) with a function test is welcome.

  2. Fix crash in fundrawtransaction when using non-solvable scripts f864e415ff
  3. jonasschnelli added the label Wallet on Oct 5, 2018
  4. jonasschnelli commented at 8:27 AM on October 5, 2018: contributor

    Fixes #14401

  5. practicalswift commented at 8:49 AM on October 5, 2018: contributor

    Some context: #14380 (comment) :-)

  6. in src/wallet/wallet.cpp:2737 in f864e415ff
    2733 | +                    int max_signed_input_size = CalculateMaximumSignedInputSize(change_prototype_txout, this);
    2734 | +                    if (max_signed_input_size < 0) {
    2735 | +                        strFailReason = _("Fee calculation failed");
    2736 | +                        return false;
    2737 | +                    }
    2738 | +                    coin_selection_params.change_spend_size = max_signed_input_size;
    


    practicalswift commented at 8:52 AM on October 5, 2018:

    Make this implicit conversion explicit :-)

  7. DrahtBot commented at 10:41 AM on October 5, 2018: member

    <!--e57a25ab6845829454e8d69fc972939a-->Reviewers, this pull request conflicts with the following ones:

    • #14380 (fix assert crash when specified change output spend size is unknown by instagibbs)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  8. gmaxwell commented at 8:29 PM on October 5, 2018: contributor

    NAK, Fixed more correctly in #14380

  9. jonasschnelli commented at 8:55 AM on October 6, 2018: contributor

    Oh. Wasn't aware of #14380. I should have done the research first. Closing.

  10. jonasschnelli closed this on Oct 6, 2018

  11. fanquake deleted a comment on Oct 7, 2018
  12. fanquake locked this on Oct 7, 2018

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-21 15:15 UTC

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