[libcxx-commits] [libcxx] [ASan][libc++] Annotating `std::basic_string` with all allocators (PR #75845)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 20 14:01:12 PST 2023


================
@@ -0,0 +1,78 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: asan
+// UNSUPPORTED: c++03
+
+// <string>
+
+// Test based on: https://bugs.chromium.org/p/chromium/issues/detail?id=1419798#c5
+// Some allocators during deallocation may not call destructors and just reuse memory.
----------------
EricWF wrote:

OK, thanks for the explanation. Gotta love non-normative notes throwing a curveball into the analysis.

I guess this makes me more open to the customization point as described because:

(1) It's an opt-out. Which given how horrendous the allocator behavior here is, is a good default.
(2) Allowing non-owners of the type to opt-out, while ODR prone, seems appropriate given the user of ASAN is likely not the writer of the ASAN hostile allocator.


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


More information about the libcxx-commits mailing list