Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ecfe3bc

Browse files
authored
Fix Segfault in PerfInfo Image Logging (#26910)
1 parent 68ff240 commit ecfe3bc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/vm/perfinfo.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,21 @@ void PerfInfo::LogImage(PEFile* pFile, WCHAR* guid)
4141

4242
SString value;
4343
const SString& path = pFile->GetPath();
44-
PEImageLayout *pLoadedLayout = pFile->GetLoaded();
45-
SIZE_T baseAddr = (SIZE_T)pLoadedLayout->GetBase();
44+
if (path.IsEmpty())
45+
{
46+
return;
47+
}
48+
49+
SIZE_T baseAddr = 0;
50+
if (pFile->IsILImageReadyToRun())
51+
{
52+
PEImageLayout *pLoadedLayout = pFile->GetLoaded();
53+
if (pLoadedLayout)
54+
{
55+
baseAddr = (SIZE_T)pLoadedLayout->GetBase();
56+
}
57+
}
58+
4659
value.Printf("%S%c%S%c%p", path.GetUnicode(), sDelimiter, guid, sDelimiter, baseAddr);
4760

4861
SString command;

0 commit comments

Comments
 (0)