Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix usage side_diff in fuzzers
  • Loading branch information
zxvfc committed Jan 10, 2026
commit a5a1baf23ed8268085a59f8df7845ed1ceb5ed08
17 changes: 13 additions & 4 deletions fuzz/fuzz_targets/fuzz_side.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
#[macro_use]
extern crate libfuzzer_sys;

use diffutilslib::side_diff;
use diffutilslib::side_diff::{self, Params};

use std::fs::File;
use std::io::Write;
use diffutilslib::params::Params;

fuzz_target!(|x: (Vec<u8>, Vec<u8>, /* usize, usize */ bool)| {
let (original, new, /* width, tabsize, */ expand) = x;
Expand All @@ -22,7 +21,16 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>, /* usize, usize */ bool)| {
..Default::default()
};
let mut output_buf = vec![];
side_diff::diff(&original, &new, &mut output_buf, &params);
side_diff::diff(
&original,
&new,
&mut output_buf,
&Params {
width: params.width,
tabsize: params.tabsize,
expand_tabs: params.expand_tabs,
},
);
File::create("target/fuzz.file.original")
.unwrap()
.write_all(&original)
Expand All @@ -39,4 +47,5 @@ fuzz_target!(|x: (Vec<u8>, Vec<u8>, /* usize, usize */ bool)| {
.unwrap()
.write_all(&output_buf)
.unwrap();
});
});