diff --git a/decode.c b/decode.c index 8a5b078..5922cca 100644 --- a/decode.c +++ b/decode.c @@ -597,7 +597,10 @@ fd_decode(const uint8_t* buffer, size_t len_sz, int mode_int, uintptr_t address, if (imm_control == 4) { - instr->imm += instr->address + off; + if (instr->address != 0) + instr->imm += instr->address + off; + else + operand->type = FD_OT_OFF; #if defined(ARCH_X86_64) // On x86-64, jumps always have an operand size of 64 bit. if (mode == DECODE_64) diff --git a/fadec.h b/fadec.h index 4c44270..abd848a 100644 --- a/fadec.h +++ b/fadec.h @@ -50,6 +50,7 @@ typedef enum { FD_OT_REG = 1, FD_OT_IMM = 2, FD_OT_MEM = 3, + FD_OT_OFF = 4, } FdOpType; typedef enum {