1
0
Fork 0

DBG+GUI: fix OperandText returning weird values for relative jumps

closes #1849
This commit is contained in:
Duncan Ogilvie 2017-12-26 13:31:10 +01:00
parent 761e2f67c0
commit 8616ff67a2
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 6 additions and 0 deletions

View File

@ -75,12 +75,18 @@ bool Zydis::Disassemble(size_t addr, const unsigned char* data, int size)
// we should probably refrain from hacking the Zydis data structure and perform
// such transformations in the getters instead.
if(op.type == ZYDIS_OPERAND_TYPE_IMMEDIATE && op.imm.isRelative)
{
ZydisCalcAbsoluteAddress(&mInstr, &op, &op.imm.value.u);
op.imm.isRelative = false; //hack to prevent OperandText from returning bogus values
}
else if(op.type == ZYDIS_OPERAND_TYPE_MEMORY &&
op.mem.base == ZYDIS_REGISTER_NONE &&
op.mem.index == ZYDIS_REGISTER_NONE &&
op.mem.disp.value != 0)
{
//TODO: what is this used for?
ZydisCalcAbsoluteAddress(&mInstr, &op, (uint64_t*)&op.mem.disp.value);
}
if(op.visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
break;