mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-03 07:31:41 +01:00
Fix an overflow in format_to_n (#2029)
This commit is contained in:
@@ -2031,6 +2031,11 @@ TEST(FormatTest, FormatToN) {
|
||||
result = fmt::format_to_n(buffer, 4, "{}", "ABCDE");
|
||||
EXPECT_EQ(5u, result.size);
|
||||
EXPECT_EQ("ABCD", fmt::string_view(buffer, 4));
|
||||
|
||||
buffer[3] = 'x';
|
||||
result = fmt::format_to_n(buffer, 3, "{}", std::string(1000, '*'));
|
||||
EXPECT_EQ(1000u, result.size);
|
||||
EXPECT_EQ("***x", fmt::string_view(buffer, 4));
|
||||
}
|
||||
|
||||
TEST(FormatTest, WideFormatToN) {
|
||||
|
||||
Reference in New Issue
Block a user