forked from OSchip/llvm-project
Make sure the memory range is writable before memset'ing it.
llvm-svn: 81308
This commit is contained in:
parent
98e0a59acc
commit
49adbf42b1
|
@ -15,6 +15,7 @@
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include "llvm/Support/Recycler.h"
|
#include "llvm/Support/Recycler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/System/Memory.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -60,6 +61,7 @@ void BumpPtrAllocator::DeallocateSlabs(MemSlab *Slab) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Poison the memory so stale pointers crash sooner. Note we must
|
// Poison the memory so stale pointers crash sooner. Note we must
|
||||||
// preserve the Size and NextPtr fields at the beginning.
|
// 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));
|
memset(Slab + 1, 0xCD, Slab->Size - sizeof(MemSlab));
|
||||||
#endif
|
#endif
|
||||||
Allocator.Deallocate(Slab);
|
Allocator.Deallocate(Slab);
|
||||||
|
|
Loading…
Reference in New Issue