From 1ae7f6bb0206497d2e6eb45845bcb6b1a0dadd37 Mon Sep 17 00:00:00 2001 From: Alexey Frolov Date: Mon, 5 Feb 2018 12:19:06 +0300 Subject: [PATCH] FIXES: - 'bloom_test_1': infinite loop if file not exists - 'websocket_test': uncatched exceptions - 'fc_crypto*' test_stream<>: uninitialized variable (hash) - 'blowfish_chain_test': using memory after allocated heap - memcmp: passing nullptr, when non-null expected - undefined behavior: return value from function - static_variant: member alignment - performance issue on 64-bit arch - memory leak: fc::thread cleanup in asio thread - warning: signed-unsigned comparison - warning: unused variables --- src/crypto/aes.cpp | 6 ++++-- src/crypto/elliptic_secp256k1.cpp | 6 ++++-- src/crypto/rand.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/crypto/aes.cpp b/src/crypto/aes.cpp index 09db92b..2dbae6c 100644 --- a/src/crypto/aes.cpp +++ b/src/crypto/aes.cpp @@ -29,7 +29,8 @@ struct aes_encoder::impl aes_encoder::aes_encoder() { - static __attribute__((unused)) int init = init_openssl(); + static int init = init_openssl(); + (void)init; } aes_encoder::~aes_encoder() @@ -97,7 +98,8 @@ struct aes_decoder::impl aes_decoder::aes_decoder() { - static __attribute__((unused)) int init = init_openssl(); + static int init = init_openssl(); + (void)init; } void aes_decoder::init( const fc::sha256& key, const fc::uint128& init_value ) diff --git a/src/crypto/elliptic_secp256k1.cpp b/src/crypto/elliptic_secp256k1.cpp index 469cc1b..ecb2c0c 100644 --- a/src/crypto/elliptic_secp256k1.cpp +++ b/src/crypto/elliptic_secp256k1.cpp @@ -29,8 +29,10 @@ namespace fc { namespace ecc { } void _init_lib() { - static __attribute__((unused)) const secp256k1_context_t* ctx = _get_context(); - static __attribute__((unused)) int init_o = init_openssl(); + static const secp256k1_context_t* ctx = _get_context(); + (void)ctx; + static int init_o = init_openssl(); + (void)init_o; } class public_key_impl diff --git a/src/crypto/rand.cpp b/src/crypto/rand.cpp index 2b194c5..6b26b46 100644 --- a/src/crypto/rand.cpp +++ b/src/crypto/rand.cpp @@ -8,7 +8,8 @@ namespace fc { void rand_bytes(char* buf, int count) { - static __attribute__((unused)) int init = init_openssl(); + static int init = init_openssl(); + (void)init; int result = RAND_bytes((unsigned char*)buf, count); if (result != 1) @@ -17,7 +18,8 @@ void rand_bytes(char* buf, int count) void rand_pseudo_bytes(char* buf, int count) { - static __attribute__((unused)) int init = init_openssl(); + static int init = init_openssl(); + (void)init; int result = RAND_pseudo_bytes((unsigned char*)buf, count); if (result == -1)