[llvm-commits] [compiler-rt] r172603 - /compiler-rt/trunk/lib/asan/asan_allocator2.cc
Kostya Serebryany
kcc at google.com
Wed Jan 16 01:12:15 PST 2013
Author: kcc
Date: Wed Jan 16 03:12:14 2013
New Revision: 172603
URL: http://llvm.org/viewvc/llvm-project?rev=172603&view=rev
Log:
[asan] asan_allocator2: fix the memalign handling (clear the first word of allocated chunk in case there is an old memalign magic)
Modified:
compiler-rt/trunk/lib/asan/asan_allocator2.cc
Modified: compiler-rt/trunk/lib/asan/asan_allocator2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator2.cc?rev=172603&r1=172602&r2=172603&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator2.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator2.cc Wed Jan 16 03:12:14 2013
@@ -347,6 +347,8 @@
allocated = allocator.Allocate(cache, needed_size, 8, false);
}
uptr alloc_beg = reinterpret_cast<uptr>(allocated);
+ // Clear the first allocated word (an old kMemalignMagic may still be there).
+ reinterpret_cast<uptr *>(alloc_beg)[0] = 0;
uptr alloc_end = alloc_beg + needed_size;
uptr beg_plus_redzone = alloc_beg + rz_size;
uptr user_beg = beg_plus_redzone;
More information about the llvm-commits
mailing list