bnb_used in CWallet::CreateTransaction(...).
bnb_used in CWallet::CreateTransaction(...).
!pick_new_inputs && nValueIn - nValueToSelect > 0 && !IsDust(newTxOut, discard_rate) then an uninitialized bnb_used is read?
2887@@ -2888,7 +2888,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
2888 }
2889
2890 // Choose coins to use
2891- bool bnb_used;
pick_new_inputs == false then below bnb_used can be used right? Other output vars (nValueIn and setCoins) are also initialized here.
use_bnb can be used uninitialized.
!pick_new_inputs. Otherwise it is hard to reason about the correctness of this patch.
@MarcoFalke I originally found this issue by using static analysis but I rediscovered it using dynamic analysis as well. It turns out that this is triggered simply running the test suite under UBSan :-)
0wallet/wallet.cpp:2757:59: runtime error: load of value 112, which is not a valid value for type 'bool' !=
See https://travis-ci.org/bitcoin/bitcoin/jobs/429944903#L3960
2825@@ -2826,7 +2826,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
2826 }
2827
2828 // Choose coins to use
2829- bool bnb_used;
2830+ bool bnb_used = false;
./configure --with-sanitizers=bool CC=clang CXX=clang++ && make -j 16 src/bitcoind && ./test/functional/rpc_fundrawtransaction.py. Could someone else try this?