[libcxx-commits] [libcxx] [libc++][hardening] Check bounds on arithmetic in __bounded_iter (PR #78876)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 14 00:06:38 PST 2024
================
@@ -151,6 +162,10 @@ struct __bounded_iter {
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __bounded_iter& operator-=(difference_type __n) _NOEXCEPT {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
----------------
var-const wrote:
Would there be any value in implementing this in terms of `operator+=`? Or would that make the call stack in case of a failed assertion too confusing?
https://github.com/llvm/llvm-project/pull/78876
More information about the libcxx-commits
mailing list