Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected test fail: wallet/wallet.cpp:3113:51: runtime error: division by zero #20542

Closed
promag opened this issue Dec 2, 2020 · 5 comments
Closed
Labels

Comments

@promag
Copy link
Contributor

promag commented Dec 2, 2020

After building promag/gui@0b0d91e

In https://bitcoinbuilds.org/index.php?ansilog=8847a501-fb20-47ed-8a8a-88d83ca7d381.log#l2039

L2035   ********* Start testing of WalletTests *********
L2036   Config: Using QtTest library 5.9.5, Qt 5.9.5 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 7.4.0)
L2037   PASS   : WalletTests::initTestCase()
L2038   wallet/wallet.cpp:3113:51: runtime error: division by zero
L2039       #0 0x559bf8ddde17 in CWallet::CreateTransactionInternal(std::vector<CRecipient, std::allocator<CRecipient> > const&, std::shared_ptr<CTransaction const>&, long&, int&, bilingual_str&, CCoinControl const&, FeeCalculation&, bool) /home/ubuntu/src/src/wallet/wallet.cpp:3113:51
L2040       #1 0x559bf8dd78a0 in CWallet::CreateTransaction(std::vector<CRecipient, std::allocator<CRecipient> > const&, std::shared_ptr<CTransaction const>&, long&, int&, bilingual_str&, CCoinControl const&, FeeCalculation&, bool) /home/ubuntu/src/src/wallet/wallet.cpp:3133:16
L2041       #2 0x559bf8b384ba in interfaces::(anonymous namespace)::WalletImpl::createTransaction(std::vector<CRecipient, std::allocator<CRecipient> > const&, CCoinControl const&, bool, int&, long&, bilingual_str&) /home/ubuntu/src/src/interfaces/wallet.cpp:235:24
L2042       #3 0x559bf7bc7685 in WalletModel::prepareTransaction(WalletModelTransaction&, CCoinControl const&) /home/ubuntu/src/src/qt/walletmodel.cpp:203:27
L2043       #4 0x559bf7afd1cd in SendCoinsDialog::PrepareSendText(QString&, QString&, QString&) /home/ubuntu/src/src/qt/sendcoinsdialog.cpp:267:28
L2044       #5 0x559bf7b02931 in SendCoinsDialog::on_sendButton_clicked() /home/ubuntu/src/src/qt/sendcoinsdialog.cpp:377:10
L2045       #6 0x559bf7c3d24d in SendCoinsDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/ubuntu/src/src/qt/moc_sendcoinsdialog.cpp:203:21
L2046       #7 0x7fe02a1a7002 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x29b002)
L2047       #8 0x7fe02a1a947c in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x29d47c)
L2048       #9 0x559bf780b54c in QMetaObject::invokeMethod(QObject*, char const*, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs.h:466:16
L2049       #10 0x559bf780b54c in (anonymous namespace)::SendCoins(CWallet&, SendCoinsDialog&, boost::variant<CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown> const&, long, bool) /home/ubuntu/src/src/qt/test/wallettests.cpp:76
L2050       #11 0x559bf78043ff in (anonymous namespace)::TestGUI(interfaces::Node&) /home/ubuntu/src/src/qt/test/wallettests.cpp:187:21
L2051       #12 0x559bf7801c68 in WalletTests::walletTests() /home/ubuntu/src/src/qt/test/wallettests.cpp:285:5
L2052       #13 0x559bf78339f2 in WalletTests::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/ubuntu/src/src/qt/test/moc_wallettests.cpp:70:21
L2053       #14 0x7fe02a1a7002 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x29b002)
L2054       #15 0x7fe029ce5799  (/usr/lib/x86_64-linux-gnu/libQt5Test.so.5+0x13799)
L2055       #16 0x7fe029ce64ef  (/usr/lib/x86_64-linux-gnu/libQt5Test.so.5+0x144ef)
L2056       #17 0x7fe029ce6a60  (/usr/lib/x86_64-linux-gnu/libQt5Test.so.5+0x14a60)
L2057       #18 0x7fe029ce702a in QTest::qExec(QObject*, int, char**) (/usr/lib/x86_64-linux-gnu/libQt5Test.so.5+0x1502a)
L2058       #19 0x559bf77ac2cc in main /home/ubuntu/src/src/qt/test/test_main.cpp:94:9
L2059       #20 0x7fe026937b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
L2060       #21 0x559bf76b4d59 in _start (/home/ubuntu/src/src/qt/test/test_bitcoin-qt+0x2633d59)
L2061   
L2062   SUMMARY: UndefinedBehaviorSanitizer: float-divide-by-zero wallet/wallet.cpp:3113:51 in 
L2063   FAIL qt/test/test_bitcoin-qt (exit status: 1)
@promag promag added the Bug label Dec 2, 2020
@fanquake
Copy link
Member

fanquake commented Dec 2, 2020

Just to clarify, this isn't a problem with master, but a failure you've seen in your own PR bitcoin-core/gui#121 ?

@promag
Copy link
Contributor Author

promag commented Dec 2, 2020

@fanquake yes, but posted here because I think it's unrelated to my PR.

@maflcko
Copy link
Member

maflcko commented Dec 2, 2020

Which line of code is this? Note that there is a assert(nSubtractFeeFromAmount != 0);

@maflcko
Copy link
Member

maflcko commented Dec 2, 2020

Oh it is this line:

100 * feeCalc.est.pass.withinTarget / (feeCalc.est.pass.totalConfirmed + feeCalc.est.pass.inMempool + feeCalc.est.pass.leftMempool),

fixed in 440f8d3

@maflcko maflcko closed this as completed Dec 2, 2020
@promag
Copy link
Contributor Author

promag commented Dec 2, 2020

Thanks @MarcoFalke, needs rebase then.

jamesob added a commit to jamesob/bitcoin that referenced this issue Dec 22, 2021
The new locale-independent atoi64 method introduced in bitcoin#20452 behaves
differently for values passed which are greater than the uint64_t max.
This commit is proof of that, meant to spur discussion on how to handle
such an incompatibility.

The change as committed in bitcoin#20542 may break some scripts which invoke
bitcoind, but more than that may have consensus implications as this
deserialization mechanism is used in CScript::ParseScript. I think this
means it's possible that bitcoin#20542 could have been an accidental soft fork?
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants