[all-commits] [llvm/llvm-project] f4c1e8: [libc++][hardening] Reclassify string_view(ptr, le...
David Benjamin via All-commits
all-commits at lists.llvm.org
Mon Mar 11 13:28:28 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f4c1e8747b33815969e60a53cab3dac4d0f55f6c
https://github.com/llvm/llvm-project/commit/f4c1e8747b33815969e60a53cab3dac4d0f55f6c
Author: David Benjamin <davidben at google.com>
Date: 2024-03-11 (Mon, 11 Mar 2024)
Changed paths:
M libcxx/include/string_view
Log Message:
-----------
[libc++][hardening] Reclassify string_view(ptr, len)'s size assertion (#79297)
The comment makes this error condition sound less problematic than it
is. If the length does not match the pointer's bounds, all
bounds-checking in string_view goes wrong. A length over PTRDIFF_MAX
cannot possibly be a correct bounds and was mostly an underflowed
negative number cast to a size_t.
The documentation for _LIBCPP_ASSERT_VALID_INPUT_RANGE discusses ranges
being valid, including an iterator and a count, which seemed appropriate
here.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list