From 2e58c3a82f4cbbd3b19bfd3db55feeeb8885ada6 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Mon, 6 Apr 2026 09:49:45 +0700 Subject: [PATCH] Avoid dropping null byte in format string --- include/fmt/base.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 49868b6d751a..be7a40d52e70 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -2690,16 +2690,16 @@ template struct fstring { static_assert(count<(is_view>::value && std::is_reference::value)...>() == 0, "passing views as lvalues is disallowed"); - if (FMT_USE_CONSTEVAL) parse_format_string(s, checker(s, arg_pack())); + if (FMT_USE_CONSTEVAL) + parse_format_string(str, checker(str, arg_pack())); constexpr bool unused = detail::enforce_compile_checks(); (void)unused; } template ::value)> FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S& s) : str(s) { - auto sv = string_view(str); if (FMT_USE_CONSTEVAL) - detail::parse_format_string(sv, checker(sv, arg_pack())); + detail::parse_format_string(str, checker(str, arg_pack())); constexpr bool unused = detail::enforce_compile_checks(); (void)unused; }