mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 22:04:09 +02:00
Div protection
This commit is contained in:
parent
a955361f6a
commit
4cf6af53bd
1 changed files with 10 additions and 6 deletions
|
@ -136,6 +136,8 @@ void BFGC::RawMarkSpan(tcmalloc_raw::Span* span, int expectedStartPage)
|
||||||
// It's possible we can overestimate elemCount, particularly for large allocations. This doesn't cause a problem
|
// It's possible we can overestimate elemCount, particularly for large allocations. This doesn't cause a problem
|
||||||
// because we can safely mark on complete random memory -- pointer values are always validated before being followed
|
// because we can safely mark on complete random memory -- pointer values are always validated before being followed
|
||||||
intptr elemStride = BF_ALIGN(rawAllocData->mType->mSize, rawAllocData->mType->mAlign);
|
intptr elemStride = BF_ALIGN(rawAllocData->mType->mSize, rawAllocData->mType->mAlign);
|
||||||
|
if (elemStride > 0)
|
||||||
|
{
|
||||||
intptr dataSize = elementSize - extraDataSize;
|
intptr dataSize = elementSize - extraDataSize;
|
||||||
intptr elemCount = dataSize / elemStride;
|
intptr elemCount = dataSize / elemStride;
|
||||||
for (intptr elemIdx = 0; elemIdx < elemCount; elemIdx++)
|
for (intptr elemIdx = 0; elemIdx < elemCount; elemIdx++)
|
||||||
|
@ -144,6 +146,7 @@ void BFGC::RawMarkSpan(tcmalloc_raw::Span* span, int expectedStartPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spanPtr = (void*)((intptr)spanPtr + elementSize);
|
spanPtr = (void*)((intptr)spanPtr + elementSize);
|
||||||
}
|
}
|
||||||
|
@ -284,6 +287,7 @@ void BFGC::RawReportHandleSpan(tcmalloc_raw::Span* span, int expectedStartPage,
|
||||||
typeSize = rawAllocData->mType->mSize;
|
typeSize = rawAllocData->mType->mSize;
|
||||||
else
|
else
|
||||||
typeSize = ((bf::System::Type_NOFLAGS*)rawAllocData->mType)->mSize;
|
typeSize = ((bf::System::Type_NOFLAGS*)rawAllocData->mType)->mSize;
|
||||||
|
if (typeSize > 0)
|
||||||
rawLeakInfo.mDataCount = (elementSize - extraDataSize) / typeSize;
|
rawLeakInfo.mDataCount = (elementSize - extraDataSize) / typeSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue