mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
PDB parsing hardening
This commit is contained in:
parent
311cdaece1
commit
6eddf12948
2 changed files with 14 additions and 8 deletions
|
@ -512,7 +512,6 @@ DbgType* COFF::CvGetType(int typeId)
|
|||
{
|
||||
TYPE_ENUM_e typeEnum = (TYPE_ENUM_e)typeId;
|
||||
DbgType* type = mCvSystemTypes[typeId];
|
||||
BF_ASSERT(type != NULL);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
@ -3439,11 +3438,11 @@ CvCompileUnit* COFF::ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* c
|
|||
|
||||
if (moduleInfo != NULL)
|
||||
{
|
||||
BfLogDbgHI("ParseCompileUnit %s %s\n", mPDBPath.c_str(), moduleInfo->mModuleName);
|
||||
BfLogDbg("ParseCompileUnit %s %s\n", mPDBPath.c_str(), moduleInfo->mModuleName);
|
||||
}
|
||||
else
|
||||
{
|
||||
BfLogDbgHI("ParseCompileUnit %s NULL\n", mPDBPath.c_str());
|
||||
BfLogDbg("ParseCompileUnit %s NULL\n", mPDBPath.c_str());
|
||||
}
|
||||
|
||||
int allocSizeStart = mAlloc.GetAllocSize();
|
||||
|
@ -4127,6 +4126,8 @@ CvCompileUnit* COFF::ParseCompileUnit(int compileUnitId)
|
|||
|
||||
int sectionSize = 0;
|
||||
uint8* sectionData = CvReadStream(moduleInfo->mStream, §ionSize);
|
||||
if (sectionData == NULL)
|
||||
return NULL;
|
||||
ParseCompileUnit(moduleInfo, NULL, sectionData, sectionSize);
|
||||
delete sectionData;
|
||||
return moduleInfo->mCompileUnit;
|
||||
|
@ -4869,7 +4870,6 @@ uint8* COFF::CvReadStream(int streamIdx, int* outSize)
|
|||
|
||||
if ((streamIdx < 0) || (streamIdx >= mCvStreamSizes.mSize))
|
||||
{
|
||||
Fail(StrFormat("Invalid PDB stream index: %d", streamIdx));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -6257,12 +6257,15 @@ void COFF::ProcessDebugInfo()
|
|||
{
|
||||
compileUnit = ParseCompileUnit(NULL, compileUnit, entry.mData, entry.mSize);
|
||||
}
|
||||
if (compileUnit != NULL)
|
||||
{
|
||||
compileUnit->mLanguage = DbgLanguage_Beef;
|
||||
mMasterCompileUnit->mLanguage = DbgLanguage_Beef;
|
||||
MapCompileUnitMethods(compileUnit);
|
||||
mEndTypeIdx = (int)linkedModule->mTypes.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void COFF::FinishHotSwap()
|
||||
{
|
||||
|
|
|
@ -9638,6 +9638,9 @@ static void PdbTestFile(WinDebugger* debugger, const StringImpl& path)
|
|||
|
||||
for (int i = 0; i < coffFile.mTypes.mSize; i++)
|
||||
coffFile.mTypes[i]->PopulateType();
|
||||
|
||||
for (int i = 0; i < coffFile.mCvModuleInfo.mSize; i++)
|
||||
coffFile.ParseCompileUnit(i);
|
||||
}
|
||||
|
||||
static void PdbTest(WinDebugger* debugger, const StringImpl& path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue