diff options
author | Abseil Team <absl-team@google.com> | 2022-09-19 09:30:00 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-09-19 09:30:43 -0700 |
commit | d4607b3f05f3f22dda383efcb0aba7e7d9359823 (patch) | |
tree | 7e194615cf3beeeb43b041f7cbb5d7f914a81709 /absl/container/internal/btree.h | |
parent | 5937b7f9d123e6b01064fdb488d6c96d28d99a75 (diff) | |
download | abseil-d4607b3f05f3f22dda383efcb0aba7e7d9359823.tar.gz abseil-d4607b3f05f3f22dda383efcb0aba7e7d9359823.tar.bz2 abseil-d4607b3f05f3f22dda383efcb0aba7e7d9359823.zip |
Make BTrees work with custom allocators that recycle memory.
The btree data structure poisons regions of memory it's not using. It leaves
these regions poisoned when it frees memory. This means that a custom memory
allocator that tries to reuse freed memory will trigger an ASAN
use-after-poison error.
The fix is to unpoison each memory region right before freeing it.
PiperOrigin-RevId: 475309671
Change-Id: I29d55c298d3d89a83e1f960deb6e93118891ff83
Diffstat (limited to 'absl/container/internal/btree.h')
-rw-r--r-- | absl/container/internal/btree.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index bdf2446e..e559bece 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -958,6 +958,7 @@ class btree_node { static void deallocate(const size_type size, btree_node *node, allocator_type *alloc) { + absl::container_internal::SanitizerUnpoisonMemoryRegion(node, size); absl::container_internal::Deallocate<Alignment()>(alloc, node, size); } |