summaryrefslogtreecommitdiff
path: root/view/elf/elfview.cpp
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-03-19 14:38:33 +0800
committerXusheng <xusheng@vector35.com>2024-03-19 16:22:11 +0800
commitaa68c7efdaf40964afe9af84612f50773d217b9b (patch)
treeff39ac1fdc00986f4a6d462ce40eb89579ad7e5f /view/elf/elfview.cpp
parent43a11aa327aea4abc1b85e3784e2fb7085d4079e (diff)
ELF view: skip 0x0 and -0x1 values when dealing with init/fini arrays
Diffstat (limited to 'view/elf/elfview.cpp')
-rw-r--r--view/elf/elfview.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index 0e82d511..84ca68f5 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -1509,13 +1509,19 @@ bool ElfView::Init()
DefineAutoSymbol(new Symbol(DataSymbol, autoSectionName, section->GetStart(), NoBinding));
virtualReader.Seek(section->GetStart());
+ uint64_t maxAddress = -1;
+ if (GetAddressSize() < 8)
+ maxAddress = (1ULL << (8 * GetAddressSize())) - 1;
+
for (uint32_t i = 0; i < section->GetLength() / m_addressSize; i++)
{
uint64_t entry;
try
{
entry = virtualReader.ReadPointer();
- if ((int64_t)entry == -1)
+ // ctor and dtor sections often contain address 0x0 and 0xffffffff as markers, we need to ignore
+ // them
+ if ((entry == 0) || (entry == maxAddress))
continue;
}
catch (const ReadException& r)