diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2021-02-13 12:26:28 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2021-02-16 09:43:18 +0000 |
commit | 8889f490ce8e4fc0e7f7b9c47f8ef46f5a509cf3 (patch) | |
tree | 76cabf3eb9a46084f9c568a20d679f818594f6f8 /external | |
parent | Merge pull request #7260 (diff) | |
download | monero-8889f490ce8e4fc0e7f7b9c47f8ef46f5a509cf3.tar.xz |
easylogging++: fix potential memory corruption
The m_typedConfigurations pointer is copied from one object to the next,
but deleted in the dtor, leading to potential double free. It is also
deleted first thing in the copy ctor, deleting uninitialized memory.
This does not seem to actually happen in practice (those functions do
not get called), but seems safer that way.
Coverity 1446562
Diffstat (limited to 'external')
-rw-r--r-- | external/easylogging++/easylogging++.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/external/easylogging++/easylogging++.cc b/external/easylogging++/easylogging++.cc index bf877c018..277de1178 100644 --- a/external/easylogging++/easylogging++.cc +++ b/external/easylogging++/easylogging++.cc @@ -713,9 +713,8 @@ Logger::Logger(const std::string& id, const Configurations& configurations, } Logger::Logger(const Logger& logger) { - base::utils::safeDelete(m_typedConfigurations); m_id = logger.m_id; - m_typedConfigurations = logger.m_typedConfigurations; + m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr; m_parentApplicationName = logger.m_parentApplicationName; m_isConfigured = logger.m_isConfigured; m_configurations = logger.m_configurations; @@ -727,7 +726,7 @@ Logger& Logger::operator=(const Logger& logger) { if (&logger != this) { base::utils::safeDelete(m_typedConfigurations); m_id = logger.m_id; - m_typedConfigurations = logger.m_typedConfigurations; + m_typedConfigurations = logger.m_typedConfigurations ? new base::TypedConfigurations(*logger.m_typedConfigurations) : nullptr; m_parentApplicationName = logger.m_parentApplicationName; m_isConfigured = logger.m_isConfigured; m_configurations = logger.m_configurations; |