This causes the fee and estimated_feerate values in the the analyzepsbt output to be off if the amount being spent exceed 21.47483647 BTC.
Fix overflow bug in analyzepsbt fee: CAmount instead of int #15582
pull sipa wants to merge 1 commits into bitcoin:master from sipa:201903_analyzepsbtoverflow changing 1 files +2 −2-
sipa commented at 10:17 PM on March 11, 2019: member
-
Fix overflow bug in analyzepsbt fee: CAmount instead of int c9963ae8b1
- sipa added this to the milestone 0.18.0 on Mar 11, 2019
-
promag commented at 10:24 PM on March 11, 2019: member
ACK c9963ae8b1a4d26d19c58e18fde9c85783edb788, deserves a test?
- fanquake added the label RPC/REST/ZMQ on Mar 11, 2019
-
DrahtBot commented at 2:03 AM on March 12, 2019: member
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
- #15508 (Refactor analyzepsbt for use outside RPC code by gwillen)
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.
-
achow101 commented at 5:23 AM on March 12, 2019: member
utACK c9963ae8b1a4d26d19c58e18fde9c85783edb788
-
jonasschnelli commented at 8:59 AM on March 12, 2019: contributor
utACK c9963ae8b1a4d26d19c58e18fde9c85783edb788
-
practicalswift commented at 10:11 AM on March 12, 2019: contributor
@sipa Very nice find. Thanks for fixing.
How did you find this issue? Did you find this by manual or tool assisted analysis?
I had this issue in my back log of conversion warnings to investigate manually but you beat me to it :-)
rpc/rawtransaction.cpp:1986: conversion to ‘int’ from ‘CAmount {aka long int}’ may alter its valueFWIW, these are all the related
CAmount(int64_t) conversion warnings I have in my back log (I haven't analysed any of these yet):policy/fees.cpp:1002: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value policy/fees.cpp:1009: conversion to ‘std::set<double>::key_type {aka double}’ from ‘CAmount {aka long int}’ may alter its value rpc/rawtransaction.cpp:1986: conversion to ‘int’ from ‘CAmount {aka long int}’ may alter its value test/mempool_tests.cpp:554: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value test/mempool_tests.cpp:558: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value test/mempool_tests.cpp:562: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value test/script_tests.cpp:166: conversion to ‘int’ from ‘CAmount {aka long int}’ may alter its value test/script_tests.cpp:332: conversion to ‘int’ from ‘CAmount {aka long int}’ may alter its value txmempool.cpp:1012: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value txmempool.cpp:1013: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value txmempool.h:235: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value txmempool.h:309: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its value wallet/test/coinselector_tests.cpp:481: conversion to ‘double’ from ‘CAmount {aka long int}’ may alter its valueutACK c9963ae8b1a4d26d19c58e18fde9c85783edb788
-
laanwj commented at 11:30 AM on March 12, 2019: member
utACK c9963ae8b1a4d26d19c58e18fde9c85783edb788
- laanwj merged this on Mar 12, 2019
- laanwj closed this on Mar 12, 2019
- laanwj referenced this in commit 59b291966e on Mar 12, 2019
- sipa added the label Needs backport on Mar 13, 2019
- MarcoFalke removed the label Needs backport on Mar 13, 2019
- MarcoFalke added the label Needs backport on Mar 13, 2019
- MarcoFalke assigned laanwj on Mar 13, 2019
- laanwj referenced this in commit 232ef630ec on Mar 13, 2019
- MarcoFalke removed the label Needs backport on Mar 13, 2019
-
fanquake commented at 1:22 AM on March 14, 2019: member
-
practicalswift commented at 8:27 AM on March 14, 2019: contributor
@sipa Are you willing to share how this bug was found? I think it would be valuable to do an informal short "post mortem" of this kind of issues.
That would allow us to reason about which mistakes that are recurring and could be candidates for identification by intelligent use of tooling.
- HashUnlimited referenced this in commit c0adb5351a on Apr 19, 2019
- MarcoFalke locked this on Dec 16, 2021
Milestone
0.18.0