mirror of
https://github.com/monero-project/monero.git
synced 2025-08-06 05:04:32 -04:00
logging: Fix easylogging++ init with blank config
The upstream version of el::base::TypedConfigurations::unsafeGetConfigByRef
accesses uninitialized memory if a key doesn't exist.
Commit b2c59af84d
patched the library to
throw in this case, avoiding the invalid access, but the more suitable
pattern, both logically, and as evidenced by the behavior of
unsafeGetConfigByVal, would be to return a const reference to a
default-initialized value with static storage duration.
This commit is contained in:
parent
915c5dc1d9
commit
8c43e33e35
2 changed files with 7 additions and 5 deletions
|
@ -209,9 +209,10 @@ TEST(logging, operator_equals_segfault)
|
|||
log2 = log1;
|
||||
}
|
||||
|
||||
TEST(logging, empty_configurations_throws)
|
||||
TEST(logging, empty_configuration)
|
||||
{
|
||||
el::Logger log1("id1", nullptr);
|
||||
const el::Configurations cfg;
|
||||
EXPECT_ANY_THROW(log1.configure(cfg));
|
||||
EXPECT_NO_THROW(log1.configure(cfg));
|
||||
EXPECT_EQ(log1.typedConfigurations()->filename(el::Level::Info), "");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue