From dbf72dd282ffa9d0d165af5b5ae0deb875905b3e Mon Sep 17 00:00:00 2001 From: Alexis Engelke Date: Sat, 2 Nov 2019 22:16:50 +0100 Subject: [PATCH] Fix VEX+REX handling --- decode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/decode.c b/decode.c index 41cea5e..8c9a92b 100644 --- a/decode.c +++ b/decode.c @@ -132,8 +132,11 @@ decode_prefixes(const uint8_t* buffer, int len, DecodeMode mode, if (mode == DECODE_32 && (byte & 0xc0) != 0xc0) goto out; - // VEX + REX/66/F2/F3/LOCK will #UD. - if (prefixes & (PREFIX_REX|PREFIX_REP|PREFIX_REPNZ|PREFIX_LOCK)) + // VEX + 66/F2/F3/LOCK will #UD. + if (prefixes & (PREFIX_REP|PREFIX_REPNZ|PREFIX_OPSZ|PREFIX_LOCK) + return -1; + // VEX + REX will #UD. + if (rex_prefix) return -1; prefixes |= PREFIX_VEX;