Skip to content

Commit 6233516

Browse files
committed
reject MIB operands in ZydisCalcAbsoluteAddressEx
MIB operands (BNDLDX/BNDSTX/BNDMK) have MPX-specific addressing semantics that don't map to a single effective address, so return ZYAN_STATUS_INVALID_ARGUMENT instead of computing a misleading value.
1 parent cb5f404 commit 6233516

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Utils.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ ZyanStatus ZydisCalcAbsoluteAddressEx(const ZydisDecodedInstruction* instruction
144144
return ZYAN_STATUS_INVALID_ARGUMENT;
145145
}
146146

147+
// `MIB` operands (`BNDLDX`/`BNDSTX`/`BNDMK`) have `MPX`-specific addressing semantics that
148+
// don't map to a single effective address, so they are not supported here
149+
if ((operand->type == ZYDIS_OPERAND_TYPE_MEMORY) &&
150+
(operand->mem.type == ZYDIS_MEMOP_TYPE_MIB))
151+
{
152+
return ZYAN_STATUS_INVALID_ARGUMENT;
153+
}
154+
147155
if ((operand->type != ZYDIS_OPERAND_TYPE_REGISTER) &&
148156
((operand->type != ZYDIS_OPERAND_TYPE_MEMORY) ||
149157
((operand->mem.base == ZYDIS_REGISTER_NONE) &&

0 commit comments

Comments
 (0)