ELF: Don't crash on duplicate section names (#26)

This commit is contained in:
Katy Coe
2020-06-16 15:35:00 +02:00
parent dee6c45056
commit 5e435465f1

View File

@@ -150,11 +150,13 @@ namespace Il2CppInspector
section_header_table = ReadArray<elf_shdr<TWord>>(conv.Long(elf_header.e_shoff), elf_header.e_shnum);
// Get section name mappings if there are any
// This is currently only used to defeat the XOR obfuscation handled below
// Note: There can be more than one section with the same name, or unnamed; we take the first section with a given name
if (elf_header.e_shtrndx < section_header_table.Length) {
var pStrtab = section_header_table[elf_header.e_shtrndx].sh_offset;
foreach (var section in section_header_table) {
var name = ReadNullTerminatedString(conv.Long(pStrtab) + section.sh_name);
sectionByName.Add(name, section);
sectionByName.TryAdd(name, section);
}
}