[libcxx-commits] [libcxx] [libc++] Fix hardening checks in std::string operator[] (PR #122414)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 10 02:26:07 PST 2025
frederick-vs-ja wrote:
No... I believe the existing checks are correct, because the standard specifies that `s[s.size()]` is well-defined and can even refer to a writable object! Although a program is only permitted to write `CharT()` to it. (Unfortunately, I have no idea how to check this.)
See
- https://en.cppreference.com/w/cpp/string/basic_string/data
- [[string.access]/2](https://eel.is/c++draft/string.access#2)
- [[string.accessors]](https://eel.is/c++draft/string.accessors)
https://github.com/llvm/llvm-project/pull/122414
More information about the libcxx-commits
mailing list