From 8cdc8c8850682d2ec40250336874ba046e9d8c21 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Fri, 11 Dec 2020 22:45:07 +0100 Subject: [PATCH] ELF: Refuse to process dumped file if no image base supplied --- Il2CppInspector.Common/FileFormatReaders/ElfReader.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector.Common/FileFormatReaders/ElfReader.cs b/Il2CppInspector.Common/FileFormatReaders/ElfReader.cs index 46f0bf3..7c0d831 100644 --- a/Il2CppInspector.Common/FileFormatReaders/ElfReader.cs +++ b/Il2CppInspector.Common/FileFormatReaders/ElfReader.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -197,6 +196,11 @@ namespace Il2CppInspector } } + // Dumped images must be rebased + if (isDumpedImage && !(LoadOptions?.ImageBase is ulong newImageBase)) { + throw new InvalidOperationException("To load a dumped ELF image, you must specify the image base virtual address"); + } + // 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