From 51f8583447a97fbd913ef961bf85a22a925395cc Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 19 Oct 2026 21:35:22 +0200 Subject: vnf: add fuzzy testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This takes advantage of the fact that fuzzy testing happens after building all the ROM files. With that, we can use these files so libfuzzer can take them as the corpus. Signed-off-by: Miquel Sabaté Solà --- lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs (limited to 'lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs') diff --git a/lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs b/lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs new file mode 100644 index 0000000..2b3b0ed --- /dev/null +++ b/lib/vnf/fuzz/fuzz_targets/fuzz-target-vnf.rs @@ -0,0 +1,12 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let policy = vnf::MemoryPolicy::default(); + let Ok(s) = std::str::from_utf8(data) else { + return; + }; + let path = std::path::Path::new(s); + let _ = vnf::Machine::from(path, 0x8000, policy); +}); -- cgit v1.2.3