Skip to content

Commit

Permalink
fix incorrect result of SymbolModuleBase::LoadDiaViaLoadLibrary
Browse files Browse the repository at this point in the history
This fixes pdbex crash - If dll not exist or has wrong architecture the LoadDiaViaLoadLibrary code will produce incorrect result and pass error checking, later this will crash pdbex as invalid memory (NULL) will be dereferenced.
  • Loading branch information
hfiref0x authored and wbenny committed Jan 31, 2020
1 parent c138afd commit 43517b7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/PDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ SymbolModuleBase::LoadDiaViaLoadLibrary()
if (!Module)
{
Result = HRESULT_FROM_WIN32(GetLastError());
return FALSE;
return Result;
}

using PDLLGETCLASSOBJECT_ROUTINE = HRESULT(WINAPI*)(REFCLSID, REFIID, LPVOID);
Expand All @@ -83,15 +83,15 @@ SymbolModuleBase::LoadDiaViaLoadLibrary()
if (!DllGetClassObject)
{
Result = HRESULT_FROM_WIN32(GetLastError());
return FALSE;
return Result;
}

CComPtr<IClassFactory> ClassFactory;
Result = DllGetClassObject(__uuidof(DiaSource), __uuidof(IClassFactory), &ClassFactory);

if (FAILED(Result))
{
return FALSE;
return Result;
}

return ClassFactory->CreateInstance(nullptr, __uuidof(IDiaDataSource), (void**)& m_DataSource);
Expand Down

0 comments on commit 43517b7

Please sign in to comment.