[llvm-commits] [llvm] r81308 - /llvm/trunk/lib/Support/Allocator.cpp
Evan Cheng
evan.cheng at apple.com
Tue Sep 8 18:45:24 PDT 2009
Author: evancheng
Date: Tue Sep 8 20:45:24 2009
New Revision: 81308
URL: http://llvm.org/viewvc/llvm-project?rev=81308&view=rev
Log:
Make sure the memory range is writable before memset'ing it.
Modified:
llvm/trunk/lib/Support/Allocator.cpp
Modified: llvm/trunk/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Allocator.cpp?rev=81308&r1=81307&r2=81308&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Allocator.cpp (original)
+++ llvm/trunk/lib/Support/Allocator.cpp Tue Sep 8 20:45:24 2009
@@ -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 @@
#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);
More information about the llvm-commits
mailing list