diff options
author | Sean Callanan <scallanan@apple.com> | 2012-08-15 20:53:52 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-08-15 20:53:52 +0000 |
commit | f92bbcd1ce5d7f1349d4ba7b3cdcd2c7c023f1b5 (patch) | |
tree | d50aebd8fcc50cdf9ca726b74bf8b97d88676155 | |
parent | d024a20bf78086e2bbe7f03ceecbe26c095d7a31 (diff) | |
download | llvm-f92bbcd1ce5d7f1349d4ba7b3cdcd2c7c023f1b5.tar.gz llvm-f92bbcd1ce5d7f1349d4ba7b3cdcd2c7c023f1b5.tar.bz2 llvm-f92bbcd1ce5d7f1349d4ba7b3cdcd2c7c023f1b5.tar.xz |
Fixed a problem in the JIT memory allocator where
allocations of executable memory would not be padded
to account for the size of the allocation header.
This resulted in undersized allocations, meaning that
when the allocation was written to later the next
allocation's header would be corrupted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161984 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index 7be6ef8cba..61bc119d30 100644 --- a/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -461,6 +461,9 @@ namespace { /// allocateCodeSection - Allocate memory for a code section. uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) { + // Grow the required block size to account for the block header + Size += sizeof(*CurBlock); + // FIXME: Alignement handling. FreeRangeHeader* candidateBlock = FreeMemoryList; FreeRangeHeader* head = FreeMemoryList; |