[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


================
@@ -70,18 +67,20 @@ struct __bounded_iter {
 
 private:
   // Create an iterator wrapping the given iterator, and whose bounds are described
-  // by the provided [begin, end) range.
+  // by the provided [begin, end] range.
   //
-  // This constructor does not check whether the resulting iterator is within its bounds.
-  // However, it does check that the provided [begin, end) range is a valid range (that
-  // is, begin <= end).
+  // Except in debug builds, the constructor does not check whether the resulting iterator
----------------
var-const wrote:

I'd remove the `in debug builds` part -- IMO this level of detail is not necessary in this comment, it can easily get out of sync, and in general I think we should think of assertion categories, hardening modes and build types as orthogonal.

https://github.com/llvm/llvm-project/pull/78876


More information about the libcxx-commits mailing list