From beeaa0e2792c03a9a018c45367e709035141c2c2 Mon Sep 17 00:00:00 2001 From: flobernd Date: Wed, 29 Nov 2017 22:47:09 +0100 Subject: [PATCH] Added additional check for invalid AVX-512 zero masks --- src/Decoder.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Decoder.c b/src/Decoder.c index b340d07..2a64174 100644 --- a/src/Decoder.c +++ b/src/Decoder.c @@ -559,6 +559,11 @@ static ZydisStatus ZydisDecodeEVEX(ZydisDecoderContext* context, instruction->raw.evex.aaa = (data[3] >> 0) & 0x07; + if (instruction->raw.evex.z && !instruction->raw.evex.aaa) + { + return ZYDIS_STATUS_INVALID_MASK; // TODO: Dedicated status code + } + // Update internal fields context->cache.W = instruction->raw.evex.W; context->cache.R = 0x01 & ~instruction->raw.evex.R;