From 6659e0893b2132453e24b06db0b47fcf854e1533 Mon Sep 17 00:00:00 2001 From: LukeFZ <17146677+LukeFZ@users.noreply.github.com> Date: Tue, 11 Mar 2025 15:12:48 +0100 Subject: [PATCH] fix symbol table loading in some modified elfs --- .../FileFormatStreams/ElfReader.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs b/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs index 6221e5d..948752f 100644 --- a/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs +++ b/Il2CppInspector.Common/FileFormatStreams/ElfReader.cs @@ -304,7 +304,7 @@ namespace Il2CppInspector } // Process relocations - var relsz = Sizeof(typeof(TSym)); + var relsz = (uint)Sizeof(typeof(TSym)); var currentRel = 0; var totalRel = rels.Count(); @@ -450,7 +450,16 @@ namespace Il2CppInspector symbolTable.Clear(); var exportTable = new Dictionary(); - foreach (var pTab in pTables) { + var alreadyProcessed = new List<(TWord offset, TWord count)>(); + + foreach (var pTab in pTables) + { + if (alreadyProcessed.Any(x => + conv.ULong(x.offset) == conv.ULong(pTab.offset) && + conv.ULong(x.count) >= conv.ULong(pTab.count))) + continue; + + alreadyProcessed.Add((pTab.offset, pTab.count)); var symbol_table = ReadArray(conv.Long(pTab.offset), conv.Int(pTab.count)); foreach (var symbol in symbol_table)