x86: handle 16bit segment bound for JMP. bug reported by Pancake & Anton Kochkov

This commit is contained in:
Nguyen Anh Quynh 2014-05-11 15:33:11 +08:00
parent 91a19232a2
commit 2d34251889
2 changed files with 12 additions and 4 deletions

View File

@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
/* Capstone Disassembler Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
/* Capstone Disassembly Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
#include <ctype.h>
#include <inttypes.h>
@ -354,6 +354,10 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
else
SStream_concat(O, "-%"PRIu64, -imm);
} else {
// handle 16bit segment bound
if (MI->csh->mode == CS_MODE_16 && imm > 0x100000)
imm -= 0x10000;
if (imm > HEX_THRESHOLD)
SStream_concat(O, "0x%"PRIx64, imm);
else

View File

@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
/* Capstone Disassembler Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013> */
/* Capstone Disassembly Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
#include <ctype.h>
#include <inttypes.h>
@ -392,6 +392,10 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
else
SStream_concat(O, "-%"PRIu64, -imm);
} else {
// handle 16bit segment bound
if (MI->csh->mode == CS_MODE_16 && imm > 0x100000)
imm -= 0x10000;
if (imm > HEX_THRESHOLD)
SStream_concat(O, "0x%"PRIx64, imm);
else