From 2ea9ea69b3c6fe033c82df16b310acd6aa8a6728 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 17 Mar 2024 06:25:49 +0000 Subject: when decoding invalid opcodes, return errors. better testing for this circumstance. --- tests/armv8/a64.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/armv8') diff --git a/tests/armv8/a64.rs b/tests/armv8/a64.rs index 38080ef..74bb89f 100644 --- a/tests/armv8/a64.rs +++ b/tests/armv8/a64.rs @@ -4757,10 +4757,14 @@ fn test_vec_shift() { #[test] fn test_reserved() { test_err([0x00, 0x00, 0x20, 0xd5], DecodeError::InvalidOpcode); + test_err([0x00, 0x00, 0x00, 0xd5], DecodeError::InvalidOpcode); } #[test] fn test_system() { + // capstone says `msr s0_0_c2_c0_0, xzr`, but this looks like an unallocated encoding? + test_err([0x1f, 0x20, 0x00, 0xd5], DecodeError::InvalidOpcode); + const TESTS: &[([u8; 4], &'static str)] = &[ ([0x00, 0x00, 0x08, 0xd5], "sys #0x0, c0, c0, #0x0, x0"), ([0x00, 0x00, 0x28, 0xd5], "sysl x0, #0x0, c0, c0, #0x0"), -- cgit v1.1