From a3fd260afc1cb7609eadf38ff0e4955e7e25ac87 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 6 Jan 2020 08:22:39 +0100 Subject: [PATCH] ELF: Ignore relocations into memory addresses not mapped from the image (part of #14) --- Il2CppInspector/FileFormatReaders/ElfReader.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector/FileFormatReaders/ElfReader.cs b/Il2CppInspector/FileFormatReaders/ElfReader.cs index c436fe3..4935c96 100644 --- a/Il2CppInspector/FileFormatReaders/ElfReader.cs +++ b/Il2CppInspector/FileFormatReaders/ElfReader.cs @@ -193,8 +193,15 @@ namespace Il2CppInspector foreach (var rel in rels) { var symValue = ReadObject(conv.Long(rel.SymbolTable) + conv.Long(rel.SymbolIndex) * relsz).st_value; // S + // Ignore relocations into memory addresses not mapped from the image + try { + Position = MapVATR(conv.ULong(rel.Offset)); + } + catch (InvalidOperationException) { + continue; + } + // The addend is specified in the struct for rela, and comes from the target location for rel - Position = MapVATR(conv.ULong(rel.Offset)); var addend = rel.Addend ?? ReadObject(); // A // Only handle relocation types we understand, skip the rest