Fix crash via division by zero assertion #11508

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2017/10/qt_cc_crash_zero changing 1 files +1 −2
  1. jonasschnelli commented at 5:46 AM on October 16, 2017: contributor

    Replaces the newly added assert for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

    Introduced in #11133 Reported by @mzhou, fixes #11501

  2. Fix crash via division by zero assertion 207408b088
  3. jonasschnelli added the label GUI on Oct 16, 2017
  4. practicalswift commented at 10:05 AM on October 16, 2017: contributor

    ACK 207408b0889caf3f5986bde4b122dbece1ed0dac :-)

  5. in src/qt/coincontroldialog.cpp:585 in 207408b088
     581 | @@ -582,8 +582,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
     582 |      QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold.");
     583 |  
     584 |      // how many satoshis the estimated fee can vary per byte we guess wrong
     585 | -    assert(nBytes != 0);
     586 | -    double dFeeVary = (double)nPayFee / nBytes;
     587 | +    double dFeeVary = (nBytes != 0) ? (double)nPayFee / nBytes : 0;
    


    promag commented at 1:18 PM on October 17, 2017:

    Nit, like above in line 567:

    double dFeeVary = nBytes > 0 ? (double)nPayFee / nBytes : 0;
    
  6. promag commented at 1:19 PM on October 17, 2017: member

    utACK 207408b.

  7. laanwj commented at 1:21 PM on October 18, 2017: member

    utACK 207408b

    Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

    Indeed, floating point division by zero is well-defined in IEEE 754 which all current platforms (certainly the ones bitcoind runs on) implement.

  8. laanwj merged this on Oct 18, 2017
  9. laanwj closed this on Oct 18, 2017

  10. laanwj referenced this in commit ffa5159cef on Oct 18, 2017
  11. PastaPastaPasta referenced this in commit 37482b673c on Dec 22, 2019
  12. PastaPastaPasta referenced this in commit e6583f1493 on Jan 2, 2020
  13. PastaPastaPasta referenced this in commit 73dfcc1b8b on Jan 4, 2020
  14. PastaPastaPasta referenced this in commit 48674d576d on Jan 12, 2020
  15. PastaPastaPasta referenced this in commit d081812092 on Jan 12, 2020
  16. PastaPastaPasta referenced this in commit 04d29ce352 on Jan 12, 2020
  17. PastaPastaPasta referenced this in commit 16e8ca699a on Jan 12, 2020
  18. PastaPastaPasta referenced this in commit 078638d3a6 on Jan 12, 2020
  19. PastaPastaPasta referenced this in commit 1665e724e2 on Jan 12, 2020
  20. PastaPastaPasta referenced this in commit 467c52c75f on Jan 16, 2020
  21. ckti referenced this in commit 117b62c705 on Mar 28, 2021
  22. DrahtBot locked this on Sep 8, 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-16 18:15 UTC

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