From 659de779e6eceeee66b4b3165a84c928220ef378 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 17 Dec 2021 16:51:24 -0800 Subject: [PATCH] Fix a UB in parse_format_specs when begin is null --- include/fmt/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 14ac2070..696b8676 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2487,7 +2487,7 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char* begin, const Char* end, SpecHandler&& handler) -> const Char* { - if (begin + 1 < end && begin[1] == '}' && is_ascii_letter(*begin) && + if (1 < end - begin && begin[1] == '}' && is_ascii_letter(*begin) && *begin != 'L') { presentation_type type = parse_presentation_type(*begin++); if (type == presentation_type::none)