Skip to content

Commit 3eb53b8

Browse files
Avoid returning a BIP9Stats object with uninitialized values
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; } ```
1 parent 70888a3 commit 3eb53b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/versionbits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex*
107107
// return the numerical statistics of blocks signalling the specified BIP9 condition in this current period
108108
BIP9Stats AbstractThresholdConditionChecker::GetStateStatisticsFor(const CBlockIndex* pindex, const Consensus::Params& params) const
109109
{
110-
BIP9Stats stats;
110+
BIP9Stats stats = {};
111111

112112
stats.period = Period(params);
113113
stats.threshold = Threshold(params);

0 commit comments

Comments
 (0)