SamboyCoding / Cpp2IL

Work-in-progress tool to reverse unity's IL2CPP toolchain.
MIT License
1.56k stars 178 forks source link

ELF: Properly handle address outside of file-backed regions #240

Closed LukeFZ closed 6 months ago

LukeFZ commented 7 months ago

Currently, only cases where the virtual address is located outside of any ELF PHT entry are handled. However, since a PHT entry can also only be partially backed by file contents, this causes normally invalid address translations to succeed, which in turn leads to weird issues later on.

I've personally seen this cause issues with retrieving method pointers from Unity.Purchasing.AppleCore.dll on Android, where methodPointers points into .bss, but Cpp2IL still tries to read them from the file due to the entry containing the section being partially file-backed.