Skip to content

Conversation

promag
Copy link
Contributor

@promag promag commented Feb 3, 2020

#17911 shows that it's possible to read the unintialized progressDialog in

} else if (progressDialog) {
if (progressDialog->wasCanceled()) {
.

And the debugger shows

(gdb) bt
#0  0x0000555556687c60 in QProgressDialog::wasCanceled() const ()
#1  0x000055555572989f in WalletView::showProgress (this=0x5555577d7a70, 
    title=..., nProgress=1) at qt/walletview.cpp:322

Closes #17911.

@promag
Copy link
Contributor Author

promag commented Feb 3, 2020

Needs backport.

@practicalswift any idea how this was unnoticed?

@DrahtBot DrahtBot added the GUI label Feb 3, 2020
@elichai
Copy link
Contributor

elichai commented Feb 4, 2020

So the actual problem this solves is here

if (progressDialog) {
and line 1342. right?
it's because we check if the pointer is null or not but we never set it to null, so it either contains a real pointer or uninitialized values.

@promag
Copy link
Contributor Author

promag commented Feb 4, 2020

@elichai that is correct.

Copy link
Contributor

@elichai elichai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK acf8abc

Copy link
Contributor

@kristapsk kristapsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK acf8abc

@promag
Copy link
Contributor Author

promag commented Feb 4, 2020

FWIW @bitcoinhodler tested this, see #17911 (comment).

@fanquake
Copy link
Member

fanquake commented Feb 4, 2020

@promag Can you add the explanation of what this is fixing and how it's fixing it to the PR description; given it's not in there already and not in the commit message either.

@promag
Copy link
Contributor Author

promag commented Feb 4, 2020

@elichai actually the code you point out is wrong, see the updated OP.

The code you point is fine because the dialog is already initialized.

@elichai
Copy link
Contributor

elichai commented Feb 5, 2020

@elichai actually the code you point out is wrong, see the updated OP.

The code you point is fine because the dialog is already initialized.

Why? both have an initialization if nProgress == 0, and both have an else if (progressDialog) how do they differ?

@promag
Copy link
Contributor Author

promag commented Feb 5, 2020

@elichai sorry for not being clear, the code you point out is fine, just that it's not where the bug is.

Note that BitcoinGUI::progressDialog is already initialized:

QProgressDialog* progressDialog = nullptr;

@maflcko
Copy link
Member

maflcko commented Feb 5, 2020

ACK acf8abc

Nice find. Remind me that we should finally get the functional tests run with the gui.

Does this need backport?

@promag
Copy link
Contributor Author

promag commented Feb 5, 2020

@MarcoFalke yes.

@maflcko maflcko added this to the 0.19.1 milestone Feb 5, 2020
Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK acf8abc, I have reviewed the code and it looks OK, I agree it can be merged.

fanquake added a commit that referenced this pull request Feb 6, 2020
acf8abc gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  #17911 shows that it's possible to read the unintialized `progressDialog` in https://github.com/bitcoin/bitcoin/blob/f32564f0a73c5ad1a107dd112e40516f39d1a51e/src/qt/walletview.cpp#L296-L297.

  And the debugger shows
  ```
  (gdb) bt
  #0  0x0000555556687c60 in QProgressDialog::wasCanceled() const ()
  #1  0x000055555572989f in WalletView::showProgress (this=0x5555577d7a70,
      title=..., nProgress=1) at qt/walletview.cpp:322
  ```

  Closes #17911.

ACKs for top commit:
  hebasto:
    ACK acf8abc, I have reviewed the code and it looks OK, I agree it can be merged.
  elichai:
    utACK acf8abc
  kristapsk:
    ACK acf8abc
  MarcoFalke:
    ACK acf8abc

Tree-SHA512: f5e6d873192d08d1a572e66e17c2e06d1ce27d01aa196b2a7ed591008641295bb02cda8ac90919ff2d2fc778316c2e143f8d36599e0d377779758853dfaf0a31
@fanquake fanquake merged commit acf8abc into bitcoin:master Feb 6, 2020
@promag promag deleted the 2020-02-fix-unitialized-progressDialog branch February 6, 2020 07:17
promag added a commit to promag/bitcoin that referenced this pull request Feb 6, 2020
fanquake added a commit that referenced this pull request Feb 6, 2020
b4e5363 gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport #18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK b4e5363
  jonasschnelli:
    utACK b4e5363

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request Feb 13, 2020
- [0.19] wallet: Reset reused transactions cache bitcoin#18083
- 0.19: Backports bitcoin#17792
- psbt: handle unspendable psbts bitcoin#17524
- qt: Fix comparison function signature bitcoin#17634
- psbt: check that various indexes and amounts are within bounds bitcoin#17156
- [0.19] psbt: check that various indexes and amounts are within bounds bitcoin#18079
- [0.19] Final backports for 0.19.1 bitcoin#17988
- Bug: IsUsedDestination shouldn't use key id as script id for ScriptHash bitcoin#17924
- qt: Fix deprecated QCharRef usage bitcoin#18101
- gui: Throttle GUI update pace when -reindex bitcoin#18121
- gui: Fix race in WalletModel::pollBalanceChanged bitcoin#18123
- gui: Fix unintialized WalletView::progressDialog bitcoin#18062
- Bugfix: GUI: Hide the HD/encrypt icons earlier so they get re-shown if another wallet is open bitcoin#18007
- bug-fix macos: give free bytes to F_PREALLOCATE bitcoin#17887
- test: add missing #include to fix compiler errors bitcoin#17980
- zmq: Fix due to invalid argument and multiple notifiers bitcoin#17445
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 24, 2021
Summary: This is a backport of [[bitcoin/bitcoin#18062 | core#18062]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9905
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…Dialog

b4e5363 gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport bitcoin#18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK bitcoin@b4e5363
  jonasschnelli:
    utACK b4e5363

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…Dialog

b4e5363 gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport bitcoin#18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK bitcoin@b4e5363
  jonasschnelli:
    utACK b4e5363

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 9, 2021
…Dialog

b4e5363 gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport bitcoin#18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK bitcoin@b4e5363
  jonasschnelli:
    utACK b4e5363

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Dec 23, 2021
…Dialog

b4e5363 gui: Fix unintialized WalletView::progressDialog (João Barbosa)

Pull request description:

  Backport bitcoin#18062 to 0.19.

ACKs for top commit:
  Empact:
    ACK bitcoin@b4e5363
  jonasschnelli:
    utACK b4e5363

Tree-SHA512: 9ebf0c29b606689de118c3d64f0a8f4dd53df05799b3be6da1891cb214c4fca7f0e3f2cd2a205c78496914cec1f7fa469d6df88428fcd6854ede6c61dbbc6d2a
@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

Successfully merging this pull request may close these issues.

segfault from importmulti
8 participants