aboutsummaryrefslogtreecommitdiff
path: root/fuzz/fuzz_targets/displaysink_used_correctly.rs
diff options
context:
space:
mode:
Diffstat (limited to 'fuzz/fuzz_targets/displaysink_used_correctly.rs')
-rw-r--r--fuzz/fuzz_targets/displaysink_used_correctly.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/fuzz/fuzz_targets/displaysink_used_correctly.rs b/fuzz/fuzz_targets/displaysink_used_correctly.rs
new file mode 100644
index 0000000..bd8d1db
--- /dev/null
+++ b/fuzz/fuzz_targets/displaysink_used_correctly.rs
@@ -0,0 +1,24 @@
+#![no_main]
+#[macro_use] extern crate libfuzzer_sys;
+extern crate yaxpeax_x86;
+extern crate yaxpeax_arch;
+
+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();
+
+ use yaxpeax_arch::testkit::DisplaySinkValidator;
+
+ if let Ok(inst) = x86_64_decoder.decode_slice(data) {
+ inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed");
+ };
+
+ if let Ok(inst) = x86_32_decoder.decode_slice(data) {
+ inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed");
+ };
+
+ if let Ok(inst) = x86_16_decoder.decode_slice(data) {
+ inst.display_into(&mut DisplaySinkValidator::new()).expect("instruction can be displayed");
+ };
+});