llvm-project
15860446 - [libc++] Fix basic_string not allowing max_size() elements to be stored (#125423)

Commit
1 year ago
[libc++] Fix basic_string not allowing max_size() elements to be stored (#125423) Without this patch `basic_string` cannot be properly resized to be `max_size()` elements in size, even if an allocation is successful. `__grow_by` allocates one less element than required, resulting in an out-of-bounds access. At the same time, `max_size()` has an off-by-one error, since there has to be space to store the null terminator, which is currently ignored.
Author
Parents
Loading