From b31d49be15ff0c86d95659249f2cddcecf513d42 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Tue, 15 Oct 2024 03:58:17 +0300 Subject: [PATCH] std: Fix std::string push_back() Allocate 2 bytes if cap == 0, not 1. --- include_std/string | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include_std/string b/include_std/string index 1127f8c..e17d3a4 100644 --- a/include_std/string +++ b/include_std/string @@ -1530,7 +1530,7 @@ namespace std constexpr void push_back(CharT ch) { if (_size == _capacity) - reserve(_capacity == 0 ? 1 : _capacity * 2); + reserve(_capacity == 0 ? 2 : _capacity * 2); _data[_size++] = ch; _data[_size] = 0;