aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_targets/display_c_does_not_panic.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2022-01-12 15:46:39 -0800
committeriximeow <me@iximeow.net>2022-01-12 15:46:39 -0800
commite80b5622ec956a92f24ce6487fb0d76e9c541515 (patch)
treed7907a83716b2a1a2ca51d37533f4dec3e9f58af /fuzz/fuzz_targets/display_c_does_not_panic.rs
parente893398115da3c5f636bc908666e0fb65e4d78d7 (diff)
fuzz DisplayStyle::C and fix corresponding issues1.1.4
Diffstat (limited to 'fuzz/fuzz_targets/display_c_does_not_panic.rs')
-rw-r--r--fuzz/fuzz_targets/display_c_does_not_panic.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/fuzz/fuzz_targets/display_c_does_not_panic.rs b/fuzz/fuzz_targets/display_c_does_not_panic.rs
new file mode 100644
index 0000000..129a560
--- /dev/null
+++ b/fuzz/fuzz_targets/display_c_does_not_panic.rs
@@ -0,0 +1,21 @@
+#![no_main]
+#[macro_use] extern crate libfuzzer_sys;
+extern crate yaxpeax_x86;
+
+fuzz_target!(|data: &[u8]| {
+ let x86_64_decoder = yaxpeax_x86::long_mode::InstDecoder::default();
+ let x86_32_decoder = yaxpeax_x86::protected_mode::InstDecoder::default();
+ let x86_16_decoder = yaxpeax_x86::real_mode::InstDecoder::default();
+
+ if let Ok(inst) = x86_64_decoder.decode_slice(data) {
+ let _ = inst.display_with(yaxpeax_x86::long_mode::DisplayStyle::C).to_string();
+ };
+
+ if let Ok(inst) = x86_32_decoder.decode_slice(data) {
+ let _ = inst.display_with(yaxpeax_x86::protected_mode::DisplayStyle::C).to_string();
+ };
+
+ if let Ok(inst) = x86_16_decoder.decode_slice(data) {
+ let _ = inst.display_with(yaxpeax_x86::real_mode::DisplayStyle::C).to_string();
+ };
+});