Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConsoleHandler: fix for out of bounds array access with dynamic log level and coloured console output #421

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions quill/src/handlers/ConsoleHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void ConsoleHandler::write(fmt_buffer_t const& formatted_log_message, TransitEve
#if defined(_WIN32)
if (_console_colours.using_colours())
{
WORD const colour_code = _console_colours.colour_code(log_event.macro_metadata->log_level());
WORD const colour_code = _console_colours.colour_code(log_event.log_level());

// Set foreground colour and store the original attributes
WORD const orig_attribs = _set_foreground_colour(colour_code);
Expand Down Expand Up @@ -218,7 +218,7 @@ void ConsoleHandler::write(fmt_buffer_t const& formatted_log_message, TransitEve
if (_console_colours.can_use_colours())
{
// Write colour code
std::string const& colour_code = _console_colours.colour_code(log_event.macro_metadata->log_level());
std::string const& colour_code = _console_colours.colour_code(log_event.log_level());

detail::fwrite_fully(colour_code.data(), sizeof(char), colour_code.size(), _file);
}
Expand Down