diff options
author | Colin Cross <ccross@android.com> | 2016-03-09 16:33:44 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-03-09 16:33:44 -0800 |
commit | b23c6606d2326f8835fc7fc35b23ff7ee5a48f48 (patch) | |
tree | 73a489c6a0c578e1ab44a8eeec781ecace382387 /libc/malloc_debug/malloc_debug.cpp | |
parent | 060d6bbe6f9c9e4a55c5ebb2724c30ec24279e8a (diff) | |
download | android_bionic-b23c6606d2326f8835fc7fc35b23ff7ee5a48f48.tar.gz android_bionic-b23c6606d2326f8835fc7fc35b23ff7ee5a48f48.tar.bz2 android_bionic-b23c6606d2326f8835fc7fc35b23ff7ee5a48f48.zip |
malloc_debug: iterate: use usable_size
malloc_iterate with malloc debug enabled was returning allocation sizes
using the requested size instead of usable size. If anything wrote
pointers above the requested size but below the usable size, those
pointers would be invisible to libmemunreachable and referenced
allocations could be reported as a leak.
Bug: 27107100
Change-Id: I6b19fd631f68ce93b3aee408cc3d296ec457bd01
Diffstat (limited to 'libc/malloc_debug/malloc_debug.cpp')
-rw-r--r-- | libc/malloc_debug/malloc_debug.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp index aa6f5f747..fdad5416c 100644 --- a/libc/malloc_debug/malloc_debug.cpp +++ b/libc/malloc_debug/malloc_debug.cpp @@ -594,7 +594,7 @@ int debug_iterate(uintptr_t base, size_t size, if (g_debug->track->Contains(header)) { // Return just the body of the allocation if we're sure the header exists ctx->callback(reinterpret_cast<uintptr_t>(g_debug->GetPointer(header)), - header->real_size(), ctx->arg); + header->usable_size, ctx->arg); return; } } |