diff options
author | MarcoFalke <falke.marco@gmail.com> | 2017-08-16 02:45:09 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-08-16 02:45:19 +0200 |
commit | a46a671e253528e450bd57645c400bf761da07ab (patch) | |
tree | 35c12bcb266f4f2f966d59fe5d746508cb2c9452 /src/versionbits.cpp | |
parent | 655970d9c60ae6850daf452457e14e21047c0e1b (diff) | |
parent | 3eb53b867153c957529484b5338d27e69de027c1 (diff) |
Merge #10957: Avoid returning a BIP9Stats object with uninitialized values
3eb53b867 Avoid returning a BIP9Stats object with uninitialized values (practicalswift)
Pull request description:
Uninitialized data potentially used in `rpc/blockchain.cpp`:
```
static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Consensus::DeploymentPos id)
{
...
const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id);
...
if (THRESHOLD_STARTED == thresholdState)
{
UniValue statsUV(UniValue::VOBJ);
BIP9Stats statsStruct = VersionBitsTipStatistics(consensusParams, id);
statsUV.push_back(Pair("period", statsStruct.period));
statsUV.push_back(Pair("threshold", statsStruct.threshold));
statsUV.push_back(Pair("elapsed", statsStruct.elapsed));
statsUV.push_back(Pair("count", statsStruct.count));
statsUV.push_back(Pair("possible", statsStruct.possible));
rv.push_back(Pair("statistics", statsUV));
}
...
return rv;
}
```
Friendly ping @pinheadmz :-)
Tree-SHA512: cc1debe11d81157b9fa8e6064bfec199524cd1e2d0230ff35f45d97ecabbc664df8423edb1c9e4ba3daf19bbd51ab87bb50e5e5cd279be1d2aa1f7d8b300f148
Diffstat (limited to 'src/versionbits.cpp')
-rw-r--r-- | src/versionbits.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/versionbits.cpp b/src/versionbits.cpp index 04a692d826..59588023ad 100644 --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -107,7 +107,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* // return the numerical statistics of blocks signalling the specified BIP9 condition in this current period BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params) const { - BIP9Stats stats; + BIP9Stats stats = {}; stats.period = Period(params); stats.threshold = Threshold(params); |