Don't crash in x86 ConsierCode when matching prologue but next opcode is not "lea eax, address"
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Il2CppInspector
|
namespace Il2CppInspector
|
||||||
@@ -51,11 +52,20 @@ namespace Il2CppInspector
|
|||||||
return (0, 0);
|
return (0, 0);
|
||||||
|
|
||||||
// lea eax, (pCgr - offset)[ebx] (Position + 6 is the opcode lea eax; Position + 8 is the operand)
|
// lea eax, (pCgr - offset)[ebx] (Position + 6 is the opcode lea eax; Position + 8 is the operand)
|
||||||
image.Position += 8;
|
image.Position += 6;
|
||||||
pCgr = image.MapVATR(image.ReadUInt32() + plt);
|
|
||||||
if (pCgr > image.Length)
|
// Ensure it's lea eax, #address
|
||||||
|
if (image.ReadUInt16() != 0x838D)
|
||||||
return (0, 0);
|
return (0, 0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
pCgr = image.MapVATR(image.ReadUInt32() + plt);
|
||||||
|
}
|
||||||
|
// Could not find a mapping in the section table
|
||||||
|
catch (InvalidOperationException) {
|
||||||
|
return (0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Extract Metadata pointer
|
// Extract Metadata pointer
|
||||||
// An 0x838D opcode indicates LEA (no indirection)
|
// An 0x838D opcode indicates LEA (no indirection)
|
||||||
image.Position = pCgr + 0x20;
|
image.Position = pCgr + 0x20;
|
||||||
|
|||||||
Reference in New Issue
Block a user