[libcxx-commits] [libcxx] [libc++][ranges][abi-break] Fix `movable_box` overwriting memory of data that lives in the tail padding (PR #71314)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 22 09:24:38 PST 2023
================
@@ -134,6 +134,20 @@ concept __doesnt_need_empty_state =
// 2. Otherwise, movable-box<T> should store only a T if either T models movable or
// is_nothrow_move_constructible_v<T> is true.
: movable<_Tp> || is_nothrow_move_constructible_v<_Tp>);
+
+// When _Tp doesn't have an assignment operator, we must implement __movable_box's assignment operator
+// by doing destroy_at followed by construct_at. However, that implementation strategy leads to UB if the nested
+// _Tp is potentially overlapping. As it is doing a non-transparent replacement of the sub-object, which means that
----------------
ldionne wrote:
```suggestion
// _Tp is potentially overlapping, as it is doing a non-transparent replacement of the sub-object, which means that
```
https://github.com/llvm/llvm-project/pull/71314
More information about the libcxx-commits
mailing list