Skip to content

Commit

Permalink
Fix a UB in parse_format_specs when begin is null
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Dec 18, 2021
1 parent 51b14b6 commit 659de77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 659de77

Please sign in to comment.