aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/long_mode')
-rw-r--r--src/long_mode/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index ef7f8c9..18b9f7b 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -5643,6 +5643,9 @@ fn read_instr<T: Iterator<Item=u8>>(decoder: &InstDecoder, mut bytes_iter: T, in
} else {
unsafe { unreachable_unchecked(); }
}
+ if instruction.opcode == Opcode::Invalid && record.1 == OperandCode::Nothing {
+ return Err(DecodeError::InvalidOpcode);
+ }
instruction.prefixes = prefixes;
read_operands(decoder, bytes_iter, instruction, record.1, &mut length)?;
instruction.length = length;
@@ -8336,6 +8339,9 @@ fn decode_x87<T: Iterator<Item=u8>>(_decoder: &InstDecoder, mut bytes_iter: T, i
}
};
instruction.opcode = opcode;
+ if instruction.opcode == Opcode::Invalid {
+ return Err(DecodeError::InvalidOpcode);
+ }
// TODO: support 80-bit operands
match x87_operands {
OperandCodeX87::Est => {