summaryrefslogtreecommitdiff
path: root/fuzz/fuzz_targets/no-panic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_targets/no-panic.rs')
-rw-r--r--fuzz/fuzz_targets/no-panic.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/fuzz/fuzz_targets/no-panic.rs b/fuzz/fuzz_targets/no-panic.rs
new file mode 100644
index 0000000..d2653dd
--- /dev/null
+++ b/fuzz/fuzz_targets/no-panic.rs
@@ -0,0 +1,18 @@
+#![no_main]
+use libfuzzer_sys::fuzz_target;
+
+use yaxpeax_arch::Decoder;
+
+use std::fmt::Write;
+
+fuzz_target!(|data: &[u8]| {
+ let decoder = yaxpeax_hexagon::InstDecoder::default();
+
+ let mut hexagon_inst = yaxpeax_hexagon::InstructionPacket::default();
+
+ let mut words = yaxpeax_arch::U8Reader::new(data);
+
+ // whatever the output, we should be able to format the instruction that was decoded into
+ let _ = decoder.decode_into(&mut hexagon_inst, &mut words);
+ write!(&mut String::new(), "{}", hexagon_inst).expect("formatting does not panic either");
+});