[Valgrind] Various uninitialized data accesses (#2389)

* [Valgrind] Uninitialized data access in bulk_pull

* Uninitialized memory access in websocket. work

* Fix rpc.wallet_create_seed

* Fix wallet.change_seed

* Fix wallet_create_fail test

* Serg review
This commit is contained in:
Wesley Shillingford 2019-11-07 21:35:49 +00:00 committed by GitHub
commit 4f4baea4e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View file

@ -733,7 +733,7 @@ TEST (websocket, work)
ASSERT_EQ (1, node1->websocket_server->subscriber_count (nano::websocket::topic::work));
// Generate work
nano::block_hash hash;
nano::block_hash hash{ 1 };
auto work (node1->work_generate_blocking (hash));
ASSERT_TRUE (work.is_initialized ());

View file

@ -792,14 +792,12 @@ bool nano::frontier_req::operator== (nano::frontier_req const & other_a) const
}
nano::bulk_pull::bulk_pull () :
message (nano::message_type::bulk_pull),
count (0)
message (nano::message_type::bulk_pull)
{
}
nano::bulk_pull::bulk_pull (bool & error_a, nano::stream & stream_a, nano::message_header const & header_a) :
message (header_a),
count (0)
message (header_a)
{
if (!error_a)
{

View file

@ -355,9 +355,9 @@ public:
void serialize (nano::stream &) const override;
bool deserialize (nano::stream &);
void visit (nano::message_visitor &) const override;
nano::hash_or_account start;
nano::block_hash end;
count_t count;
nano::hash_or_account start{ 0 };
nano::block_hash end{ 0 };
count_t count{ 0 };
bool is_count_present () const;
void set_count_present (bool);
static size_t constexpr count_present_flag = nano::message_header::bulk_pull_count_present_flag;

View file

@ -111,7 +111,7 @@ public:
static size_t const seed_iv_index;
static int const special_count;
nano::kdf & kdf;
MDB_dbi handle;
MDB_dbi handle{ 0 };
std::recursive_mutex mutex;
private:

View file

@ -977,6 +977,7 @@ TEST (rpc, wallet_create_seed)
nano::system system (24000, 1);
scoped_io_thread_name_change scoped_thread_name_io;
nano::raw_key seed;
nano::random_pool::generate_block (seed.data.bytes.data (), seed.data.bytes.size ());
auto prv = nano::deterministic_key (seed, 0);
auto pub (nano::pub_key (prv));
auto node = system.nodes.front ();
@ -3575,9 +3576,11 @@ TEST (rpc, wallet_change_seed)
{
nano::system system0 (24000, 1);
nano::raw_key seed;
nano::random_pool::generate_block (seed.data.bytes.data (), seed.data.bytes.size ());
{
auto transaction (system0.nodes[0]->wallets.tx_begin_read ());
nano::raw_key seed0;
nano::random_pool::generate_block (seed0.data.bytes.data (), seed0.data.bytes.size ());
system0.wallet (0)->store.seed (seed0, transaction);
ASSERT_NE (seed, seed0);
}