aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2009-09-12 22:26:39 +0000
committerTanya Lattner <tonic@nondot.org>2009-09-12 22:26:39 +0000
commit90f271424b0189546abe98f0e85313cada7fbca2 (patch)
treea6bd56b2234890f4c02b779c29f31552dfb98237
parenta087e06d042c4b12caf6b051715f41f0167c0d70 (diff)
Merge 81308 from mainline.
Make sure the memory range is writable before memset'ing it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_26@81638 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/Allocator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp
index 36da443207..7a3fd87c17 100644
--- a/lib/Support/Allocator.cpp
+++ b/lib/Support/Allocator.cpp
@@ -15,6 +15,7 @@
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Recycler.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/System/Memory.h"
#include <cstring>
namespace llvm {
@@ -60,6 +61,7 @@ void BumpPtrAllocator::DeallocateSlabs(MemSlab *Slab) {
#ifndef NDEBUG
// Poison the memory so stale pointers crash sooner. Note we must
// preserve the Size and NextPtr fields at the beginning.
+ sys::Memory::setRangeWritable(Slab + 1, Slab->Size - sizeof(MemSlab));
memset(Slab + 1, 0xCD, Slab->Size - sizeof(MemSlab));
#endif
Allocator.Deallocate(Slab);