From baa1bc243ac9e2b8c0930d6e7bed7065d0e2e5e0 Mon Sep 17 00:00:00 2001 From: flobernd Date: Tue, 25 Apr 2017 17:46:02 +0200 Subject: [PATCH] Fixed decoding of VEX/EVEX instructions with high-register-specifiers --- src/Decoder.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Decoder.c b/src/Decoder.c index f4ebd29..39310f0 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -1795,7 +1795,8 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* ctx, { uint8_t nextInput; ZYDIS_CHECK(ZydisInputPeek(ctx, info, &nextInput)); - if ((nextInput & 0xF0) >= 0xC0) + if (((nextInput & 0xF0) >= 0xC0) || + (ctx->operatingMode == ZYDIS_OPERATING_MODE_64BIT)) { if (info->attributes & ZYDIS_ATTRIB_HAS_REX) { @@ -1856,7 +1857,7 @@ static ZydisStatus ZydisNodeHandlerOpcode(ZydisDecoderContext* ctx, { uint8_t nextInput; ZYDIS_CHECK(ZydisInputPeek(ctx, info, &nextInput)); - if (((nextInput >> 0) & 0x1F) >= 8) + if ((nextInput & 0x1F) >= 8) { if (info->attributes & ZYDIS_ATTRIB_HAS_REX) {