From 2da03f897bea8fb35b89bcaca76660ea956935c9 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:01:46 -0700 Subject: [PATCH 01/10] Fixes CID 1147436 uninitialized scalar field. --- src/chainparams.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/chainparams.h b/src/chainparams.h index c60baf6e3..853a43e22 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -92,23 +92,23 @@ protected: CMessageHeader::MessageStartChars pchMessageStart; //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; - int nDefaultPort; - int nMinerThreads; - long nMaxTipAge; - uint64_t nPruneAfterHeight; - unsigned int nEquihashN; - unsigned int nEquihashK; + int nDefaultPort = 0; + int nMinerThreads = 0; + long nMaxTipAge = 0; + uint64_t nPruneAfterHeight = 0; + unsigned int nEquihashN = 0; + unsigned int nEquihashK = 0; std::vector vSeeds; std::vector base58Prefixes[MAX_BASE58_TYPES]; std::string strNetworkID; CBlock genesis; std::vector vFixedSeeds; - bool fRequireRPCPassword; - bool fMiningRequiresPeers; - bool fDefaultConsistencyChecks; - bool fRequireStandard; - bool fMineBlocksOnDemand; - bool fTestnetToBeDeprecatedFieldRPC; + bool fRequireRPCPassword = false; + bool fMiningRequiresPeers = false; + bool fDefaultConsistencyChecks = false; + bool fRequireStandard = false; + bool fMineBlocksOnDemand = false; + bool fTestnetToBeDeprecatedFieldRPC = false; Checkpoints::CCheckpointData checkpointData; std::vector vFoundersRewardAddress; }; From 9a4127e74c31f769cc1a505e667beb563c9baa07 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:05:30 -0700 Subject: [PATCH 02/10] Fixes CID 1352706 uninitialized scalar field. --- src/chainparamsbase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 4369d0aef..33765f0fc 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -29,7 +29,7 @@ public: protected: CBaseChainParams() {} - int nRPCPort; + int nRPCPort = 0; std::string strDataDir; }; From b1c1a32b3a0309bf65aa59e8e43c83c566695ae5 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:17:17 -0700 Subject: [PATCH 03/10] Fixes CID 1352698 uninitialized scalar field. --- src/policy/fees.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/policy/fees.h b/src/policy/fees.h index 15577d128..d37d4b184 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -66,6 +66,9 @@ class CTxMemPoolEntry; * they've been outstanding. */ +/** Decay of .998 is a half-life of 346 blocks or about 2.4 days */ +static const double DEFAULT_DECAY = .998; + /** * We will instantiate two instances of this class, one to track transactions * that were included in a block due to fee, and one for tx's included due to @@ -105,7 +108,7 @@ private: // Combine the total value with the tx counts to calculate the avg fee/priority per bucket std::string dataTypeString; - double decay; + double decay = DEFAULT_DECAY; // Mempool counts of outstanding transactions // For each bucket X, track the number of transactions in the mempool @@ -179,9 +182,6 @@ public: /** Track confirm delays up to 25 blocks, can't estimate beyond that */ static const unsigned int MAX_BLOCK_CONFIRMS = 25; -/** Decay of .998 is a half-life of 346 blocks or about 2.4 days */ -static const double DEFAULT_DECAY = .998; - /** Require greater than 85% of X fee transactions to be confirmed within Y blocks for X to be big enough */ static const double MIN_SUCCESS_PCT = .85; static const double UNLIKELY_PCT = .5; From b7727d8b3b37bded0144363be5ffebc70b5e9f36 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:19:36 -0700 Subject: [PATCH 04/10] Fixes CID 1352687 uninitialized scalar field. --- src/zcash/Note.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zcash/Note.hpp b/src/zcash/Note.hpp index 8cf53e5b4..460e68f9d 100644 --- a/src/zcash/Note.hpp +++ b/src/zcash/Note.hpp @@ -26,7 +26,7 @@ public: class NotePlaintext { public: - uint64_t value; + uint64_t value = 0; uint256 rho; uint256 r; boost::array memo; From 19bec4d9bb43dc5b67e6c05f609ac9a92af1f6b4 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:25:36 -0700 Subject: [PATCH 05/10] Fixes CID 1352715 uninitialized scalar field. --- src/zcash/IncrementalMerkleTree.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zcash/IncrementalMerkleTree.hpp b/src/zcash/IncrementalMerkleTree.hpp index 1d023168a..cd21bf651 100644 --- a/src/zcash/IncrementalMerkleTree.hpp +++ b/src/zcash/IncrementalMerkleTree.hpp @@ -163,7 +163,7 @@ private: IncrementalMerkleTree tree; std::vector filled; boost::optional> cursor; - size_t cursor_depth; + size_t cursor_depth = 0; std::deque partial_path() const; IncrementalWitness(IncrementalMerkleTree tree) : tree(tree) {} }; From 43873535d4aa7091945cfdfffcfcf162070b5e06 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:28:22 -0700 Subject: [PATCH 06/10] Fixes CID 1352686 uninitialized scalar variable. --- src/txmempool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/txmempool.h b/src/txmempool.h index a6901fde6..e6fd8e60b 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -92,7 +92,7 @@ private: unsigned int nTransactionsUpdated; CBlockPolicyEstimator* minerPolicyEstimator; - uint64_t totalTxSize; //! sum of all mempool tx' byte sizes + uint64_t totalTxSize = 0; //! sum of all mempool tx' byte sizes public: mutable CCriticalSection cs; From 351b38fd5b1b10d26deb659fec3f34671095b477 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:35:51 -0700 Subject: [PATCH 07/10] Fixes CID 1352599 unitialized scalar variable --- src/primitives/transaction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 2e83773c4..9ed8012bf 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -52,7 +52,7 @@ public: // These contain trapdoors, values and other information // that the recipient needs, including a memo field. It // is encrypted using the scheme implemented in crypto/NoteEncryption.cpp - boost::array ciphertexts; + boost::array ciphertexts = {0}; // Random seed uint256 randomSeed; From fed6c83ccf2edb30fe8aaa047353adc102deec89 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:40:22 -0700 Subject: [PATCH 08/10] Fixes CID 1352727 uninitialized scalar variable. --- src/primitives/transaction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 9ed8012bf..5d93de66b 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -307,7 +307,7 @@ public: const uint32_t nLockTime; const std::vector vjoinsplit; const uint256 joinSplitPubKey; - const joinsplit_sig_t joinSplitSig; + const joinsplit_sig_t joinSplitSig = {0}; /** Construct a CTransaction that qualifies as IsNull() */ CTransaction(); From ccc0f9af4235d0043a272e58b53b6306821f8059 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 20 Oct 2016 11:41:28 -0700 Subject: [PATCH 09/10] Fixes CID 1352714 uninitialized scalar variable. --- src/primitives/transaction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 5d93de66b..31b057796 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -386,7 +386,7 @@ struct CMutableTransaction uint32_t nLockTime; std::vector vjoinsplit; uint256 joinSplitPubKey; - CTransaction::joinsplit_sig_t joinSplitSig; + CTransaction::joinsplit_sig_t joinSplitSig = {0}; CMutableTransaction(); CMutableTransaction(const CTransaction& tx); From e11e61ddb1357e7fb4abc02e5232f37adc146e5c Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 21 Oct 2016 09:12:24 -0700 Subject: [PATCH 10/10] Workaround g++ 5.x bug with brace enclosed initializer. http://stackoverflow.com/questions/32912921/whats-wrong-with-this-inline-initialization-of-stdarray/32912976#32912976 --- src/primitives/transaction.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 31b057796..34c5f1eb6 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -52,7 +52,7 @@ public: // These contain trapdoors, values and other information // that the recipient needs, including a memo field. It // is encrypted using the scheme implemented in crypto/NoteEncryption.cpp - boost::array ciphertexts = {0}; + boost::array ciphertexts = {{ {{0}} }}; // Random seed uint256 randomSeed; @@ -307,7 +307,7 @@ public: const uint32_t nLockTime; const std::vector vjoinsplit; const uint256 joinSplitPubKey; - const joinsplit_sig_t joinSplitSig = {0}; + const joinsplit_sig_t joinSplitSig = {{0}}; /** Construct a CTransaction that qualifies as IsNull() */ CTransaction(); @@ -386,7 +386,7 @@ struct CMutableTransaction uint32_t nLockTime; std::vector vjoinsplit; uint256 joinSplitPubKey; - CTransaction::joinsplit_sig_t joinSplitSig = {0}; + CTransaction::joinsplit_sig_t joinSplitSig = {{0}}; CMutableTransaction(); CMutableTransaction(const CTransaction& tx);