diff options
| author | Jordan Wiens <github@psifertex.com> | 2026-02-19 18:55:48 -0500 |
|---|---|---|
| committer | Jordan Wiens <github@psifertex.com> | 2026-02-19 18:55:48 -0500 |
| commit | 4573354f23da495099983dac4b665988cd837ff5 (patch) | |
| tree | 47a9afceff247f7dce6bc8e539cb3d054a5720c3 /view/elf | |
| parent | bcc40473b3660005e83f51150bdc17ae177768dc (diff) | |
guard against empty .interp and .dynamic
Diffstat (limited to 'view/elf')
| -rw-r--r-- | view/elf/elfview.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index a3d60456..ef325474 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -550,8 +550,10 @@ bool ElfView::Init() break; } - if (!foundMatch) + if (!foundMatch && i.memorySize) AddAutoSection(".dynamic", adjustedVirtualAddr, i.memorySize, ReadOnlyDataSectionSemantics, "DYNAMIC", i.align, entrySize); + else if (!foundMatch) + m_logger->LogWarn("Skipping zero-length .dynamic section at 0x%" PRIx64, adjustedVirtualAddr); } else if (i.type == ELF_PT_INTERP) { @@ -572,8 +574,10 @@ bool ElfView::Init() break; } - if (!foundMatch) + if (!foundMatch && i.memorySize) AddAutoSection(".interp", adjustedVirtualAddr, i.memorySize, ReadOnlyDataSectionSemantics, "PROGBITS", i.align); + else if (!foundMatch) + m_logger->LogWarn("Skipping zero-length .interp section at 0x%" PRIx64, adjustedVirtualAddr); DefineDataVariable(adjustedVirtualAddr, Type::ArrayType(Type::IntegerType(1, true), i.fileSize)); DefineAutoSymbol(new Symbol(DataSymbol, "__elf_interp", adjustedVirtualAddr, LocalBinding)); |
