[libcxx-commits] [libcxx] [libc++][hardening] Check bounds on arithmetic in __bounded_iter (PR #78876)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 9 11:11:10 PST 2024


================
@@ -20,77 +20,156 @@ struct Foo {
     int x;
 };
 
+template <typename Iter>
+void test_iterator(Iter begin, Iter end, bool reverse) {
+  ptrdiff_t distance = std::distance(begin, end);
----------------
ldionne wrote:

Nit
```suggestion
  std::ptrdiff_t distance = std::distance(begin, end);
```

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


More information about the libcxx-commits mailing list