aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorA. Jiang <de34@live.cn>2025-06-12 22:53:41 +0800
committerGitHub <noreply@github.com>2025-06-12 10:53:41 -0400
commitbba4ded3c2f94fe0de6011a6941b135b3cb0370a (patch)
treef28bb30d2ae3a9498483babc817015976805c812 /lldb/source/Commands/CommandObjectMemory.cpp
parentca5b71a4559890a9768558ddea724782fb638bfa (diff)
downloadllvm-bba4ded3c2f94fe0de6011a6941b135b3cb0370a.zip
llvm-bba4ded3c2f94fe0de6011a6941b135b3cb0370a.tar.gz
llvm-bba4ded3c2f94fe0de6011a6941b135b3cb0370a.tar.bz2
[libc++] Fix constructing `bitset` from non-null-terminated arrays (#143691)
Unconditional evaluation of `char_traits<_CharT>::length(__str)` is problematic, because it causes UB when `__str` points to a non-null-terminated array. We should only call `length` (currently, in `basic_string_view`'s constructor) when `__n == npos` per [bitset.cons]/8. Drive-by change: Reduction of conditional compilation, given that - both `basic_string_view<_CharT>::size_type` and `basic_string<_CharT>::size_type` must be `size_t`, and thus - both `basic_string_view<_CharT>::npos` and `basic_string<_CharT>::npos` must be `size_t(-1)`. For the type sameness in the standard wording, see: - [string.view.template.general] - [basic.string.general] - [allocator.traits.types]/6 - [default.allocator.general]/1 Fixes #143684
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
0 files changed, 0 insertions, 0 deletions