summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-09-09 01:45:24 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-09-09 01:45:24 +0000
commit49adbf42b1baa422769e0e45f932fe355d932bba (patch)
tree6d5563ceecaf3433b69206df8269543e1fede7a7 /llvm/lib/Support
parent98e0a59accea9c71cb502b5ec429d117c028e945 (diff)
downloadbcm5719-llvm-49adbf42b1baa422769e0e45f932fe355d932bba.tar.gz
bcm5719-llvm-49adbf42b1baa422769e0e45f932fe355d932bba.zip
Make sure the memory range is writable before memset'ing it.
llvm-svn: 81308
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Allocator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Support/Allocator.cpp b/llvm/lib/Support/Allocator.cpp
index 36da4432073..7a3fd87c17e 100644
--- a/llvm/lib/Support/Allocator.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud