ELF: Don't decrypt if there is no .rodata section (part of #21)

This commit is contained in:
Katy Coe
2020-02-13 18:05:26 +01:00
parent 37f43580e4
commit 9083be4c18

View File

@@ -252,7 +252,7 @@ namespace Il2CppInspector
Console.WriteLine($"Processed {rels.Count} relocations");
// Detect and defeat trivial XOR encryption
if (dynamic_table.Any(d => (Elf) conv.Int(d.d_tag) == Elf.DT_INIT)) {
if (getDynamic(Elf.DT_INIT) != null && sectionByName.ContainsKey(".rodata")) {
var rodataFirstBytes = ReadArray<byte>(conv.Long(sectionByName[".rodata"].sh_offset), 256);
var xorKey = rodataFirstBytes.GroupBy(b => b).OrderByDescending(f => f.Count()).First().Key;