mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 02:21:34 +08:00
Validate range in wincolor_sink::print_range_
This commit is contained in:
parent
0ade18828d
commit
4a5bc41e89
@ -144,9 +144,12 @@ std::uint16_t SPDLOG_INLINE wincolor_sink<ConsoleMutex>::set_foreground_color_(s
|
||||
template<typename ConsoleMutex>
|
||||
void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::print_range_(const memory_buf_t &formatted, size_t start, size_t end)
|
||||
{
|
||||
auto size = static_cast<DWORD>(end - start);
|
||||
auto ignored = ::WriteConsoleA(static_cast<HANDLE>(out_handle_), formatted.data() + start, size, nullptr, nullptr);
|
||||
(void)(ignored);
|
||||
if (end > start)
|
||||
{
|
||||
auto size = static_cast<DWORD>(end - start);
|
||||
auto ignored = ::WriteConsoleA(static_cast<HANDLE>(out_handle_), formatted.data() + start, size, nullptr, nullptr);
|
||||
(void)(ignored);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename ConsoleMutex>
|
||||
|
Loading…
Reference in New Issue
Block a user