[libcxx-commits] [libcxx] [libc++][hardening] Use bounded iterators in std::vector and std::string (PR #78929)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 10:02:57 PDT 2024


================
@@ -786,9 +787,16 @@ public:
                 "[allocator.requirements] states that rebinding an allocator to the same type should result in the "
                 "original allocator");
 
-  // TODO: Implement iterator bounds checking without requiring the global database.
+#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS
----------------
ldionne wrote:

```suggestion
#ifdef _LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING
```

I think we should introduce this under its own ABI macro, and the same for vector. And we should rename the existing macro to explicitly mention the containers they enable. I think that's the only way to pretend that these ABI macros yield a somewhat stable ABI.

In this patch, please introduce `_LIBCPP_ABI_BOUNDED_ITERATORS_IN_STRING` and `_LIBCPP_ABI_BOUNDED_ITERATORS_IN_VECTOR` and I can handle the related cleanup as a follow-up.

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


More information about the libcxx-commits mailing list