[Pkg-bitcoin-commits] [bitcoin] 03/126: Avoid returning a BIP9Stats object with uninitialized values

Jonas Smedegaard dr at jones.dk
Mon Nov 13 20:00:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.15.1_dfsg-1
in repository bitcoin.

commit 50bd3f626d7ce35d52543b88a2e512074f9df134
Author: practicalswift <practicalswift at users.noreply.github.com>
Date:   Sun Jul 30 23:36:33 2017 +0200

    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;
    }
    ```
    
    Github-Pull: #10957
    Rebased-From: 3eb53b867153c957529484b5338d27e69de027c1
---
 src/versionbits.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/versionbits.cpp b/src/versionbits.cpp
index 04a692d..5958802 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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bitcoin.git



More information about the Pkg-bitcoin-commits mailing list