Protect CKeyHolderStorage via mutex#1834
Merged
UdjinM6 merged 1 commit intodashpay:developfrom Jan 9, 2018
Merged
Conversation
9 tasks
|
utACK |
1 similar comment
|
utACK |
UdjinM6
added a commit
to UdjinM6/dash
that referenced
this pull request
Jan 9, 2018
codablock
reviewed
Jan 9, 2018
| LOCK(cs_storage); | ||
| storage.emplace_back(std::unique_ptr<CKeyHolder>(new CKeyHolder(pwallet))); | ||
| LogPrintf("CKeyHolderStorage::%s -- storage size %lld\n", __func__, storage.size()); | ||
| return *storage.back(); |
There was a problem hiding this comment.
This leaks a reference to an unlocked entry in storage. The reference seems to be only used to call GetScriptForDestination() on it. Maybe it's better to change this method to return a copy of the pubKey instead?
Author
There was a problem hiding this comment.
Indeed. pubKey is a private member however and since we never actually need anything else but corresponding CScript anyway I guess changing this to return storage.back().GetScriptForDestination(); should do the job.
NarubyRiverlione
added a commit
to NarubyRiverlione/spice
that referenced
this pull request
Feb 4, 2018
* 'spice' of github.com:NarubyRiverlione/spice: (8382 commits) updated testnet genessis spice images more rename genesis blocks ports magic message letters start letter addresses cleanup : * remove gitian signatures * remove seeds rename: more originale files rename Prepare 0.12.2.3 release notes (dashpay#1846) Avoid reference leakage in CKeyHolderStorage::AddKey (dashpay#1840) Protect CKeyHolderStorage via mutex (dashpay#1834) Skip existing masternode conections on mixing (dashpay#1833) Merge pull request dashpay#1836 from lodgepole/feature/backport-11847 Fix -liquidityprovider option (dashpay#1829) Vote on IS only if it was accepted to mempool (dashpay#1826) bump version to 0.12.2.3 (dashpay#1827) Merge bitcoin#8256: BUG: bitcoin-qt crash Swap iterations and fUseInstantSend parameters in ApproximateBestSubset (dashpay#1819) Fix crash on exit when -createwalletbackups=0 (dashpay#1810) Prepare v0.12.2.2 release notes (dashpay#1769) Force rcc to use resource format version 1. (dashpay#1784) ... # Conflicts: # contrib/gitian-descriptors/gitian-osx-signer.yml # contrib/gitian-descriptors/gitian-win-signer.yml # src/chainparams.cpp # src/qt/res/icons/bitcoin.icns # src/qt/res/icons/bitcoin.ico # src/qt/res/icons/bitcoin.png # src/qt/res/icons/crownium/about.png # src/qt/res/icons/drkblue/about.png # src/qt/res/icons/drkblue/bitcoin.png # src/qt/res/icons/light/about.png # src/qt/res/icons/light/remove.png # src/qt/res/icons/remove.png # src/qt/res/icons/trad/about.png # src/qt/res/icons/trad/remove.png
andvgal
pushed a commit
to energicryptocurrency/gen2-energi
that referenced
this pull request
Dec 26, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sometimes
dscarrives at the same time we decide that session is timed out. This leads to a situation whenkeyHolderStorageis accessed from two threads which in its turn leads to a crash. Protecting internal vector via mutex should solve this.