Merge pull request #5613

2cbe756 p2p: fix GCC 9.1 crash (moneromooo-monero)
35c20c4 Fix GCC 9.1 build warnings (moneromooo-monero)
e284889 cmake: do not use -mmitigate-rop on GCC >= 9.1 (moneromooo-monero)
This commit is contained in:
luigi1111 2019-06-11 18:13:09 -05:00
commit c48722caa9
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
5 changed files with 31 additions and 6 deletions

View File

@ -672,8 +672,11 @@ else()
add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS) add_cxx_flag_if_supported(-fstack-clash-protection CXX_SECURITY_FLAGS)
endif() endif()
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS) # Removed in GCC 9.1 (or before ?), but still accepted, so spams the output
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS) if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
add_c_flag_if_supported(-mmitigate-rop C_SECURITY_FLAGS)
add_cxx_flag_if_supported(-mmitigate-rop CXX_SECURITY_FLAGS)
endif()
# linker # linker
if (NOT WIN32) if (NOT WIN32)

View File

@ -294,6 +294,11 @@ namespace net_utils
m_max_speed_up(0) m_max_speed_up(0)
{} {}
connection_context_base(const connection_context_base& a): connection_context_base()
{
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);
}
connection_context_base& operator=(const connection_context_base& a) connection_context_base& operator=(const connection_context_base& a)
{ {
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl); set_details(a.m_connection_id, a.m_remote_address, a.m_is_income, a.m_ssl);

View File

@ -90,6 +90,20 @@ namespace hw {
AKout = keys.AKout; AKout = keys.AKout;
} }
ABPkeys &ABPkeys::operator=(const ABPkeys& keys) {
if (&keys == this)
return *this;
Aout = keys.Aout;
Bout = keys.Bout;
is_subaddress = keys.is_subaddress;
is_change_address = keys.is_change_address;
additional_key = keys.additional_key;
index = keys.index;
Pout = keys.Pout;
AKout = keys.AKout;
return *this;
}
bool Keymap::find(const rct::key& P, ABPkeys& keys) const { bool Keymap::find(const rct::key& P, ABPkeys& keys) const {
size_t sz = ABP.size(); size_t sz = ABP.size();
for (size_t i=0; i<sz; i++) { for (size_t i=0; i<sz; i++) {

View File

@ -77,6 +77,7 @@ namespace hw {
ABPkeys(const rct::key& A, const rct::key& B, const bool is_subaddr, bool is_subaddress, bool is_change_address, size_t index, const rct::key& P,const rct::key& AK); ABPkeys(const rct::key& A, const rct::key& B, const bool is_subaddr, bool is_subaddress, bool is_change_address, size_t index, const rct::key& P,const rct::key& AK);
ABPkeys(const ABPkeys& keys) ; ABPkeys(const ABPkeys& keys) ;
ABPkeys() {index=0;is_subaddress=false;is_subaddress=false;is_change_address=false;} ABPkeys() {index=0;is_subaddress=false;is_subaddress=false;is_change_address=false;}
ABPkeys &operator=(const ABPkeys &keys);
}; };
class Keymap { class Keymap {

View File

@ -134,10 +134,11 @@ namespace boost
a & port; a & port;
a & length; a & length;
if (length > net::tor_address::buffer_size()) const size_t buffer_size = net::tor_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_tor_address, "Tor address too long"); MONERO_THROW(net::error::invalid_tor_address, "Tor address too long");
char host[net::tor_address::buffer_size()] = {0}; char host[buffer_size] = {0};
a.load_binary(host, length); a.load_binary(host, length);
host[sizeof(host) - 1] = 0; host[sizeof(host) - 1] = 0;
@ -155,10 +156,11 @@ namespace boost
a & port; a & port;
a & length; a & length;
if (length > net::i2p_address::buffer_size()) const size_t buffer_size = net::i2p_address::buffer_size();
if (length > buffer_size)
MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long"); MONERO_THROW(net::error::invalid_i2p_address, "i2p address too long");
char host[net::i2p_address::buffer_size()] = {0}; char host[buffer_size] = {0};
a.load_binary(host, length); a.load_binary(host, length);
host[sizeof(host) - 1] = 0; host[sizeof(host) - 1] = 0;