From 4eca42b2411c7ff11fea7b9b64881509d90932e3 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Oct 2018 10:09:57 +0000 Subject: [PATCH 1/5] blockchain_db: initialize m_hardfork in ctor just in case Coverity 136568 --- src/blockchain_db/blockchain_db.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 396ae7544..71c46d76b 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -544,7 +544,7 @@ public: /** * @brief An empty constructor. */ - BlockchainDB(): m_open(false) { } + BlockchainDB(): m_hardfork(NULL), m_open(false) { } /** * @brief An empty destructor. From 32123789129372f1a4cb46a8aa289843e15a4b37 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Oct 2018 10:14:27 +0000 Subject: [PATCH 2/5] wallet2: initialize some scalar fields in ctor where appropriate Coverity 188336 --- src/wallet/wallet2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index d774c54c0..fae972cf8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -809,6 +809,7 @@ wallet_keys_unlocker::~wallet_keys_unlocker() wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended): m_multisig_rescan_info(NULL), m_multisig_rescan_k(NULL), + m_upper_transaction_weight_limit(0), m_run(true), m_callback(0), m_trusted_daemon(false), @@ -841,6 +842,9 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended): m_is_initialized(false), m_kdf_rounds(kdf_rounds), is_old_file_format(false), + m_watch_only(false), + m_multisig(false), + m_multisig_threshold(0), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex), m_subaddress_lookahead_major(SUBADDRESS_LOOKAHEAD_MAJOR), m_subaddress_lookahead_minor(SUBADDRESS_LOOKAHEAD_MINOR), From 7cc39845be1cfa9286dec589d4f1c94381b140d9 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Oct 2018 10:22:24 +0000 Subject: [PATCH 3/5] account: init creation timestamp to 0 Never actually used uninitialized Coverity 136615 --- src/cryptonote_basic/account.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp index e891a748d..1dc1ad71d 100644 --- a/src/cryptonote_basic/account.cpp +++ b/src/cryptonote_basic/account.cpp @@ -136,6 +136,7 @@ DISABLE_VS_WARNINGS(4244 4345) void account_base::set_null() { m_keys = account_keys(); + m_creation_timestamp = 0; } //----------------------------------------------------------------- void account_base::forget_spend_key() From bfa2dce171e2a04096c07f204037ccd13dc2fae6 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Oct 2018 10:35:34 +0000 Subject: [PATCH 4/5] rpc: remove unused ctors Also prevents coverity from moaning about them not initializing fields --- src/rpc/core_rpc_server_commands_defs.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 3b654d4cb..b229841d6 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -782,9 +782,6 @@ namespace cryptonote std::string tx_as_hex; bool do_not_relay; - request() {} - explicit request(const transaction &); - BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(tx_as_hex) KV_SERIALIZE_OPT(do_not_relay, false) From 3ffbec1556f8817cb014fcea83bccc41747cfcf5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 16 Oct 2018 10:36:49 +0000 Subject: [PATCH 5/5] rpc: init m_rpc_version in Message ctor Coverity 182501 --- src/rpc/message.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/message.h b/src/rpc/message.h index 16b8e92fc..56087b998 100644 --- a/src/rpc/message.h +++ b/src/rpc/message.h @@ -65,7 +65,7 @@ namespace rpc static const char* STATUS_BAD_REQUEST; static const char* STATUS_BAD_JSON; - Message() : status(STATUS_OK) { } + Message() : status(STATUS_OK), rpc_version(0) { } virtual ~Message() { }