Fix a UB in parse_format_specs when begin is null

This commit is contained in:
Victor Zverovich 2021-12-17 16:51:24 -08:00
parent 51b14b6c0c
commit 659de779e6

View File

@ -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)