[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:37 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.
   //
----------------
var-const wrote:

Unrelated to this line: can you please check if the comment on the default constructor needs a little rephrasing? It says that the singular iterator is "conceptually out of bounds", but with the new invariant, perhaps it would be more precise/correct to say that it points to the past-the-end element?

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


More information about the libcxx-commits mailing list