From c93381c429737e3101f68c49e838ade804218071 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sat, 30 Nov 2024 11:56:23 +0000 Subject: [PATCH] Add fuzzing --- backend/fuzz/.gitignore | 4 ++++ backend/fuzz/Cargo.toml | 19 +++++++++++++++++++ backend/fuzz/fuzz_targets/reconcile.rs | 9 +++++++++ 3 files changed, 32 insertions(+) create mode 100644 backend/fuzz/.gitignore create mode 100644 backend/fuzz/Cargo.toml create mode 100644 backend/fuzz/fuzz_targets/reconcile.rs diff --git a/backend/fuzz/.gitignore b/backend/fuzz/.gitignore new file mode 100644 index 00000000..1a45eee7 --- /dev/null +++ b/backend/fuzz/.gitignore @@ -0,0 +1,4 @@ +target +corpus +artifacts +coverage diff --git a/backend/fuzz/Cargo.toml b/backend/fuzz/Cargo.toml new file mode 100644 index 00000000..d69b009a --- /dev/null +++ b/backend/fuzz/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "reconcile-fuzz" +version = "0.0.0" +publish = false +edition = "2021" + +[package.metadata] +cargo-fuzz = true + +[dependencies] +libfuzzer-sys = "0.4" +reconcile = { path = "../reconcile" } + +[[bin]] +name = "reconcile" +path = "fuzz_targets/reconcile.rs" +test = false +doc = false +bench = false diff --git a/backend/fuzz/fuzz_targets/reconcile.rs b/backend/fuzz/fuzz_targets/reconcile.rs new file mode 100644 index 00000000..e986ccb4 --- /dev/null +++ b/backend/fuzz/fuzz_targets/reconcile.rs @@ -0,0 +1,9 @@ +#![no_main] + +use libfuzzer_sys::fuzz_target; +extern crate reconcile; + +fuzz_target!(|texts: (String, String, String)| { + let (original, left, right) = texts; + reconcile::reconcile(&original, &left, &right); +});