mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 10:08:00 +02:00
Added write-past-end detection in debug allocator
This commit is contained in:
parent
be05439421
commit
e623449e24
3 changed files with 156 additions and 23 deletions
|
@ -292,10 +292,12 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::Reflection::TypeInstan
|
|||
{
|
||||
BF_ASSERT((BFRTFLAGS & BfRtFlags_ObjectHasDebugFlags) != 0);
|
||||
Object* result;
|
||||
intptr allocSize = BF_ALIGN(size, typeInst->mInstAlign);
|
||||
|
||||
//TODO: Why did we align this?
|
||||
//intptr allocSize = BF_ALIGN(size, typeInst->mInstAlign);
|
||||
intptr allocSize = size;
|
||||
|
||||
uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, typeInst->_GetType());
|
||||
// int dataOffset = (int)(sizeof(intptr) * 2);
|
||||
// memset(allocBytes + dataOffset, 0, size - dataOffset);
|
||||
result = (bf::System::Object*)allocBytes;
|
||||
auto classVData = typeInst->mTypeClassVData;
|
||||
(void)classVData;
|
||||
|
@ -343,10 +345,11 @@ bf::System::Object* Internal::Dbg_ObjectAlloc(bf::System::ClassVData* classVData
|
|||
bf::System::Object* result;
|
||||
if ((BFRTFLAGS & BfRtFlags_LeakCheck) != 0)
|
||||
{
|
||||
allocSize = BF_ALIGN(allocSize, align);
|
||||
//TODO: Why did we align this?
|
||||
//intptr allocSize = BF_ALIGN(size, typeInst->mInstAlign);
|
||||
intptr allocSize = size;
|
||||
|
||||
uint8* allocBytes = (uint8*)BfObjectAllocate(allocSize, classVData->mType);
|
||||
// int dataOffset = (int)(sizeof(intptr) * 2);
|
||||
// memset(allocBytes + dataOffset, 0, size - dataOffset);
|
||||
result = (bf::System::Object*)(allocBytes);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue