[PATCH] D50101: [asan] Update a vector's storage annotation during destruction.
Ben via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 31 13:32:16 PDT 2018
bobsayshilol created this revision.
bobsayshilol added reviewers: mclow.lists, EricWF.
Herald added subscribers: cfe-commits, ldionne.
This allows a user replaced operator delete to modify or reuse returned memory in the case where the size and capacity of a vector do not match upon destruction and hence leave a portion of the memory poisoned.
This consequently also balances __annotate_delete() calls with those of __annotate_new().
Repository:
rCXX libc++
https://reviews.llvm.org/D50101
Files:
include/vector
Index: include/vector
===================================================================
--- include/vector
+++ include/vector
@@ -540,13 +540,14 @@
value_type,
typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
-#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
~vector()
{
+ __annotate_delete();
+#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__erase_c(this);
- }
#endif
+ }
vector(const vector& __x);
vector(const vector& __x, const allocator_type& __a);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50101.158370.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180731/1bc149e8/attachment.bin>
More information about the cfe-commits
mailing list