mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Fix out of bounds vector write in Logger::addOutput(ILogOutput *out)
Previously, the invocation of Logger::addOutput(ILogOutput *out) led to an out of bounds write of the m_outputs vector, resulting in the m_silenced_levels array being modified. Fortunately, the only caller of that method was android system logging, and only since a few commits ago.
This commit is contained in:
parent
7d5c736531
commit
1f76808e4f
@ -172,7 +172,7 @@ LogLevel Logger::stringToLevel(const std::string &name)
|
|||||||
|
|
||||||
void Logger::addOutput(ILogOutput *out)
|
void Logger::addOutput(ILogOutput *out)
|
||||||
{
|
{
|
||||||
addOutputMaxLevel(out, LL_MAX);
|
addOutputMaxLevel(out, (LogLevel)(LL_MAX - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::addOutput(ILogOutput *out, LogLevel lev)
|
void Logger::addOutput(ILogOutput *out, LogLevel lev)
|
||||||
@ -182,6 +182,7 @@ void Logger::addOutput(ILogOutput *out, LogLevel lev)
|
|||||||
|
|
||||||
void Logger::addOutputMaxLevel(ILogOutput *out, LogLevel lev)
|
void Logger::addOutputMaxLevel(ILogOutput *out, LogLevel lev)
|
||||||
{
|
{
|
||||||
|
assert(lev < LL_MAX);
|
||||||
for (size_t i = 0; i <= lev; i++)
|
for (size_t i = 0; i <= lev; i++)
|
||||||
m_outputs[i].push_back(out);
|
m_outputs[i].push_back(out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user