summaryrefslogtreecommitdiff
path: root/view/elf/elfview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'view/elf/elfview.cpp')
-rw-r--r--view/elf/elfview.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index d7dc1203..536e016e 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -451,16 +451,15 @@ bool ElfView::Init()
bool initialImageBaseSet = false;
for (const auto& i : m_programHeaders)
{
- if ((i.type != ELF_PT_LOAD) || (!i.fileSize))
+ // Skip segments that are not loadable or have no memory size
+ if ((i.type != ELF_PT_LOAD) || (i.memorySize == 0))
continue;
- if (!initialImageBaseSet)
+ if (!initialImageBaseSet || (i.virtualAddress < initialImageBase))
{
initialImageBase = i.virtualAddress;
initialImageBaseSet = true;
}
- else if (i.virtualAddress < initialImageBase)
- initialImageBase = i.virtualAddress;
}
SetOriginalImageBase(initialImageBase);