From 35fc0bc549cadac4bbc187f346ec4abaa97a0969 Mon Sep 17 00:00:00 2001 From: techmetx11 Date: Wed, 3 Jul 2024 22:40:50 +0100 Subject: [PATCH] Fix an error with the opcode decoder (sig) --- src/opcode.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opcode.rs b/src/opcode.rs index 1aa4c61..2ca3629 100644 --- a/src/opcode.rs +++ b/src/opcode.rs @@ -60,9 +60,9 @@ impl Decoder for OpcodeDecoder { return Ok(None); } - let sig_size: u16 = (src[5] as u16) << 8 | (src[6] as u16); + let sig_size: u16 = u16::from_be_bytes(src[5..6].try_into().unwrap()); - if usize::from(sig_size) > src.len() { + if (usize::from(sig_size) + 7) > src.len() { return Ok(None); }