From 27d222966504223578684db02eb466abddc85679 Mon Sep 17 00:00:00 2001 From: Quietust Date: Sun, 25 Sep 2016 18:29:57 -0500 Subject: [PATCH] Fix follow_jmp for 64-bit code - skip REX prefix if found --- library/VTableInterpose.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/VTableInterpose.cpp b/library/VTableInterpose.cpp index c547800c2..520d91061 100644 --- a/library/VTableInterpose.cpp +++ b/library/VTableInterpose.cpp @@ -96,12 +96,13 @@ static uint32_t *follow_jmp(void *ptr) { switch (*p) { - case 0xE9: // jmp near rel32 #ifdef DFHACK64 - p += 5 + *(int32_t*)(p+1) + 1; -#else - p += 5 + *(int32_t*)(p+1); + case 0x48: // REX prefix + p++; + break; #endif + case 0xE9: // jmp near rel32 + p += 5 + *(int32_t*)(p+1); break; case 0xEB: // jmp short rel8 p += 2 + *(int8_t*)(p+1);