From 90a59f5d59f89bd7c2249a92178c8b5d73cbb120 Mon Sep 17 00:00:00 2001 From: Tomek-Stolarczyk Date: Wed, 18 Jun 2025 11:39:29 -0400 Subject: [PATCH] Since memset operates on (unsigned char), we should multiply the count in our call to memset with the sizeof T to clear the whole memory block. --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 5149fd66..108307eb 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -553,7 +553,7 @@ FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) template FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { if (is_constant_evaluated()) return fill_n(out, count, value); - std::memset(out, value, to_unsigned(count)); + std::memset(out, value, to_unsigned(count) * sizeof(T)); return out + count; }