Skip to content

Commit 9f66062

Browse files
authored
[libc++] Disable CFI in __libcpp_allocate (#124805)
Since we're casting uninitialized memory, we must disable CFI checks.
1 parent 9d8dc45 commit 9f66062

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcxx/include/__new/allocate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ _LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) _NOEXCEPT {
5050
}
5151

5252
template <class _Tp>
53-
inline _LIBCPP_HIDE_FROM_ABI _Tp* __libcpp_allocate(__element_count __n, size_t __align = _LIBCPP_ALIGNOF(_Tp)) {
53+
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp*
54+
__libcpp_allocate(__element_count __n, size_t __align = _LIBCPP_ALIGNOF(_Tp)) {
5455
size_t __size = static_cast<size_t>(__n) * sizeof(_Tp);
5556
#if _LIBCPP_HAS_ALIGNED_ALLOCATION
5657
if (__is_overaligned_for_new(__align)) {

0 commit comments

Comments
 (0)