x86: fix target addresses of CALL/JMP rel16. bug reported by Ruslan Kabatsayev
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index 0c4c03b..6b2f2c7 100644
--- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c
@@ -461,6 +461,10 @@
imm = imm & 0xffffffff;
}
+ // CALL/JMP rel16 is special
+ if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2)
+ imm = imm & 0xffff;
+
if (imm < 0) {
SStream_concat(O, "0x%"PRIx64, imm);
} else {
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 6eb8b96..9036048 100644
--- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c
@@ -543,6 +543,10 @@
imm = imm & 0xffffffff;
}
+ // CALL/JMP rel16 is special
+ if (MI->Opcode == X86_CALLpcrel16 || MI->Opcode == X86_JMP_2)
+ imm = imm & 0xffff;
+
if (imm < 0) {
SStream_concat(O, "0x%"PRIx64, imm);
} else {