Fix potential heap corruption in code cache.
This commit is contained in:
@@ -88,7 +88,6 @@ void* X64CodeCache::PlaceCode(void* machine_code, size_t code_size,
|
|||||||
|
|
||||||
// Add entry to fn table.
|
// Add entry to fn table.
|
||||||
active_chunk_->AddTableEntry(final_address, code_size, stack_size);
|
active_chunk_->AddTableEntry(final_address, code_size, stack_size);
|
||||||
|
|
||||||
lock_.unlock();
|
lock_.unlock();
|
||||||
|
|
||||||
// Copy code.
|
// Copy code.
|
||||||
@@ -210,8 +209,7 @@ void X64CodeChunk::AddTableEntry(uint8_t* code, size_t code_size,
|
|||||||
|
|
||||||
// Allocate unwind data. We know we have space because we overallocated.
|
// Allocate unwind data. We know we have space because we overallocated.
|
||||||
// This should be the tailing 16b with 16b alignment.
|
// This should be the tailing 16b with 16b alignment.
|
||||||
size_t unwind_info_offset = offset;
|
size_t unwind_info_offset = offset - UNWIND_INFO_SIZE;
|
||||||
offset += UNWIND_INFO_SIZE;
|
|
||||||
|
|
||||||
if (!stack_size) {
|
if (!stack_size) {
|
||||||
// http://msdn.microsoft.com/en-us/library/ddssxxy8.aspx
|
// http://msdn.microsoft.com/en-us/library/ddssxxy8.aspx
|
||||||
|
|||||||
Reference in New Issue
Block a user