From 959c61e28e05a37aa19cc226d0f5b525610d47d7 Mon Sep 17 00:00:00 2001 From: iximeow Date: Mon, 3 Aug 2020 00:50:18 -0700 Subject: long instructions --- src/long_mode/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs index 2f5fe5d..e79c8cb 100644 --- a/src/long_mode/mod.rs +++ b/src/long_mode/mod.rs @@ -5516,6 +5516,9 @@ fn read_instr>(decoder: &InstDecoder, mut bytes_iter: T, in match bytes_iter.next() { Some(b) => { length += 1; + if length > 15 { + return Err(DecodeError::TooLong); + } let record = OPCODES[b as usize]; if (b & 0xf0) == 0x40 { prefixes.rex_from(b); @@ -5649,6 +5652,9 @@ fn read_instr>(decoder: &InstDecoder, mut bytes_iter: T, in } instruction.prefixes = prefixes; read_operands(decoder, bytes_iter, instruction, record.1, &mut length)?; + if length > 15 { + return Err(DecodeError::TooLong); + } instruction.length = length; if decoder != &InstDecoder::default() { -- cgit v1.1