From 28a7f2a3eef1f43e170ccdfa2ca5d9ad2b3b5faa Mon Sep 17 00:00:00 2001 From: daniel-k Date: Tue, 23 Jan 2018 10:09:06 +0100 Subject: [PATCH] spdlog: fix handling of too long logger names `whitespace` overflows because the result implicitly is an unsigned value. --- .../spdlog/include/spdlog/details/pattern_formatter_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fpga/thirdparty/spdlog/include/spdlog/details/pattern_formatter_impl.h b/fpga/thirdparty/spdlog/include/spdlog/details/pattern_formatter_impl.h index de0f0f2d5..6457d1034 100644 --- a/fpga/thirdparty/spdlog/include/spdlog/details/pattern_formatter_impl.h +++ b/fpga/thirdparty/spdlog/include/spdlog/details/pattern_formatter_impl.h @@ -19,6 +19,7 @@ #include #include #include +#include namespace spdlog { @@ -40,7 +41,7 @@ namespace class name_formatter:public flag_formatter { std::string center(std::string input, int width) { - const auto whitespace = width - input.length(); + const int whitespace = std::max(int(width - input.length()), 0); return std::string(whitespace / 2, ' ') + input + std::string(whitespace / 2, ' ')