You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[libc++] Correctly handle custom deleters in hardened unique_ptr<T[]> (#110685)
It turns out that we can never do bounds-checking for unique_ptrs with
custom deleters, except when converting from a unique_ptr with a default
deleter to one with a custom deleter.
If we had an API like `std::make_unique` that allowed passing a custom
deleter, we could at least get bounds checking when the unique_ptr is
created through those APIs, but for now that is not possible.
Fixes#110683
Copy file name to clipboardExpand all lines: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/assert.subscript.pass.cpp
+15-26Lines changed: 15 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -48,31 +48,24 @@ struct MyDeleter {
48
48
49
49
template <classWithCookie, classNoCookie>
50
50
voidtest() {
51
-
// For types with an array cookie, we can always detect OOB accesses.
51
+
// For types with an array cookie, we can always detect OOB accesses. Note that reliance on an array
52
+
// cookie is limited to the default deleter, since a unique_ptr with a custom deleter may not have
Copy file name to clipboardExpand all lines: libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.observers/op_subscript.runtime.pass.cpp
0 commit comments