aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2021-09-28 19:51:35 -0700
committeriximeow <me@iximeow.net>2021-09-28 19:52:37 -0700
commit3a4b54bc496cf71b771e32cfb3ad0f2e804df610 (patch)
tree690865c3134093e723c7e3c7e1ac2757fcb9db74
parent44f4179c626dc346f51063e6fbfcd2e85171d9c8 (diff)
handle another unintended panic in display impl
-rw-r--r--CHANGELOG6
-rw-r--r--src/armv7.rs5
-rw-r--r--test/armv7/thumb.rs4
3 files changed, 10 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 33b9c48..13cffe2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
## 0.1.2
* fix some instructions in aarch64 decoding panicking with "unreachable"
- instead of returning an `Err(DecodeError::Incomplete)`.
+ instead of returning an `Err(DecodeError::Incomplete)`. similarly, some
+ instructions panicked instead of returning `InvalidOpcode` or `InvalidOperand`
+ as they should.
+* fix some instructions in armv7 decoding or display panicking instead of
+ displaying a valid instruction, or returning a decode error.
## 0.1.1
* fix incorrect `yaxpeax_arch::Arch` impl for `std`-enabled builds
diff --git a/src/armv7.rs b/src/armv7.rs
index e858566..d8c2539 100644
--- a/src/armv7.rs
+++ b/src/armv7.rs
@@ -1741,10 +1741,7 @@ fn format_reg_imm_mem<T: fmt::Write, Y: YaxColors>(f: &mut T, Rn: Reg, imm: u16,
(true, false) => {
write!(f, "[{}]", reg_name_colorize(Rn, colors))
},
- (false, true) => {
- unreachable!("I don't know how to render an operand with pre==false and wback==true, this seems like it should be LDRT");
- },
- (false, false) => {
+ (false, _) => {
write!(f, "[{}]", reg_name_colorize(Rn, colors))
}
}
diff --git a/test/armv7/thumb.rs b/test/armv7/thumb.rs
index c74da37..9182f6e 100644
--- a/test/armv7/thumb.rs
+++ b/test/armv7/thumb.rs
@@ -3588,6 +3588,10 @@ fn test_decode_str_32b_cases() {
&[0x41, 0xf8, 0x04, 0x2b],
"str.w r2, [r1], 0x4"
);
+ test_display(
+ &[0x41, 0xf8, 0x00, 0x2b],
+ "str.w r2, [r1]"
+ );
}
#[test]