From 7c53ed7ee4e7b577842d6f1c230783a6aa51921d Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Wed, 12 Aug 2026 23:41:50 -0300 Subject: [PATCH 1/8] build(deps): add test-case as a dev-dependency The side-by-side layout tests need parameterized cases so that each width and tab size shows up as its own named test instead of a loop that reports a single failure with no indication of which input broke. --- Cargo.lock | 34 ++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 35 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index af7c96e..b287de2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -274,6 +274,7 @@ dependencies = [ "regex", "same-file", "tempfile", + "test-case", "unicode-width", ] @@ -776,6 +777,39 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" +[[package]] +name = "test-case" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +dependencies = [ + "test-case-macros", +] + +[[package]] +name = "test-case-core" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "test-case-macros" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "test-case-core", +] + [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" diff --git a/Cargo.toml b/Cargo.toml index ded812c..a23e9bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ pretty_assertions = "1.4.0" predicates = "3.1.0" rand = "0.10.0" tempfile = "3.26.0" +test-case = "3.3.1" [profile.release] lto = "thin" From fc18aa5df6070ed746ca15e306e51c3e12243a8d Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Wed, 12 Aug 2026 23:43:19 -0300 Subject: [PATCH 2/8] fix(side-diff): compute the column layout without signed casts `Config::new` sized the side-by-side columns with signed arithmetic on the `--tabsize` value, which `params.rs` accepts with no upper bound. `tab_size + GUTTER_WIDTH_MIN` overflowed for a large one: with `-C overflow-checks=on` that aborted, and in release it wrapped and drew bogus widths. A value above `isize::MAX` did not even abort, it cast to a negative number and silently laid the columns out as if the tab size were small. Closes #264. The calculation moves into `Config::layout`, in `usize` throughout, and holds for every input on its own rather than relying on validation upstream: - An early return for `tab_size > full_width`. This is exact, not a clamp: the offset is a multiple of `tab_size`, so it is either zero or already past the right edge, and neither leaves room for a second column. It is also what keeps the sum below in range. - `saturating_add` for the gutter sum, which covers the one case the strict `>` lets through, `full_width == tab_size == usize::MAX`. - `saturating_sub` for the two bounds that could go negative. `full_width = 5, tab_size = 8` really does produce an offset past the right edge. - `usize::midpoint` for the balance point, which cannot overflow. - `saturating_sub` on `separator_pos`, which underflowed for a zero width. Unreachable from the CLI, reachable through the library. A tab stop every zero columns has no meaning and every reader of `tab_size` divides by it, so `Config::new` now normalizes it to one. The layout alone was not enough: fixing it only moved the division by zero from `layout` to `format_tabs_and_spaces`. The new `mod layout` covers the boundaries, including the two that pin the design down: `full_width = 10, tab_size = 8` still leaves two columns, so no looser guard is correct, and `tab_size == full_width` yields a non-zero offset with an empty half line. --- src/side_diff.rs | 191 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 171 insertions(+), 20 deletions(-) diff --git a/src/side_diff.rs b/src/side_diff.rs index 56953d2..e4fbf9d 100644 --- a/src/side_diff.rs +++ b/src/side_diff.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE-* // files that was distributed with this source code. -use core::cmp::{max, min}; +use core::cmp::min; use diff::Result; use std::{io::Write, vec}; use unicode_width::UnicodeWidthStr; @@ -74,26 +74,49 @@ impl<'a> Iterator for CharIter<'a> { impl Config { pub fn new(full_width: usize, tab_size: usize, expanded: bool) -> Self { - // diff uses this calculation to calculate the size of a half line - // based on the options passed (like -w, -t, etc.). It's actually - // pretty useless, because we (actually) don't have any size modifiers - // that can change this, however I just want to leave the calculate - // here, since it's not very clear and may cause some confusion - - let w = full_width as isize; - let t = tab_size as isize; - let t_plus_g = t + GUTTER_WIDTH_MIN as isize; - let unaligned_off = (w >> 1) + (t_plus_g >> 1) + (w & t_plus_g & 1); - let off = unaligned_off - unaligned_off % t; - let hw = max(0, min(off - GUTTER_WIDTH_MIN as isize, w - off)) as usize; - let c2o = if hw != 0 { off as usize } else { w as usize }; + let tab_size = tab_size.max(1); + + let (half_width, column_two_offset) = Self::layout(full_width, tab_size); Self { expanded, - sdiff_column_two_offset: c2o, + sdiff_column_two_offset: column_two_offset, tab_size, - sdiff_half_width: hw, - separator_pos: ((hw + c2o - 1) >> 1), + sdiff_half_width: half_width, + separator_pos: (half_width + column_two_offset).saturating_sub(1) >> 1, + } + } + + fn layout(full_width: usize, tab_size: usize) -> (usize, usize) { + debug_assert!(tab_size != 0); + + // The offset is a multiple of tab_size, so a tab stop wider than the + // whole line leaves only two possibilities, zero, or past the right + // edge. Neither leaves room for a second column, so the layout + // collapses to one + if tab_size > full_width { + return (0, full_width); + } + + // Column two starts at the tab stop nearest the midpoint of the two + // halves. midpoint instead of (full_width + span) / 2 because that + // sum does not fit for a width near usize::MAX. The saturation covers + // a value within GUTTER_WIDTH_MIN of usize::MAX on a line of equal width. + let span = tab_size.saturating_add(GUTTER_WIDTH_MIN); + let balance = full_width.midpoint(span); + let offset = balance - balance % tab_size; + + // If either bound would go negative, the half line does not fit. + let half_width = min( + offset.saturating_sub(GUTTER_WIDTH_MIN), + full_width.saturating_sub(offset), + ); + + // If it does not fit, one column spans the whole line. + if half_width == 0 { + (0, full_width) + } else { + (half_width, offset) } } } @@ -223,7 +246,6 @@ fn process_half_line( } } - // gnu sdiff do not tabulate the hole empty right line, instead, just keep the line empty if !is_right { // we always sum + 1 or + GUTTER_WIDTH_MIN cause we want to expand // up to the third column of the gutter column if the gutter is gutter white space, @@ -312,8 +334,6 @@ pub fn diff( output: &mut T, params: &Params, ) -> Vec { - // ^ The left file ^ The right file - let mut left_lines: Vec<&[u8]> = from_file.split_inclusive(|&c| c == b'\n').collect(); let mut right_lines: Vec<&[u8]> = to_file.split_inclusive(|&c| c == b'\n').collect(); let config = Config::new(params.width, params.tabsize, params.expand_tabs); @@ -367,6 +387,136 @@ mod tests { use super::*; + mod layout { + use super::*; + use test_case::test_case; + + #[track_caller] + fn assert_layout( + full_width: usize, + tab_size: usize, + half_width: usize, + column_two_offset: usize, + separator_pos: usize, + ) { + let config = Config::new(full_width, tab_size, false); + + assert_eq!(config.sdiff_half_width, half_width, "half width"); + assert_eq!( + config.sdiff_column_two_offset, column_two_offset, + "column two offset" + ); + assert_eq!(config.separator_pos, separator_pos, "separator pos"); + } + + #[test] + fn default_width_and_tab_size() { + assert_layout(130, 8, 61, 64, 62); + } + + #[test] + fn common_widths() { + assert_layout(80, 8, 37, 40, 38); + assert_layout(10, 7, 3, 7, 4); + } + + #[test] + fn tab_size_wider_than_the_gutter_still_leaves_two_columns() { + assert_layout(10, 8, 2, 8, 4); + } + + #[test] + fn tab_size_equal_to_the_width_leaves_one_column() { + assert_layout(10, 10, 0, 10, 4); + } + + #[test] + fn tab_size_wider_than_the_width_leaves_one_column() { + assert_layout(10, 11, 0, 10, 4); + } + + #[test] + fn smallest_width_the_cli_accepts() { + assert_layout(1, 8, 0, 1, 0); + } + + #[test] + fn column_two_offset_past_the_right_edge() { + assert_layout(5, 8, 0, 5, 2); + } + + #[test] + fn huge_tab_size() { + assert_layout(130, usize::MAX, 0, 130, 64); + assert_layout(130, usize::MAX / 2, 0, 130, 64); + assert_layout(130, 9223372036854775805, 0, 130, 64); + } + + #[test] + fn huge_width() { + let half = usize::MAX / 2 - 2; + let offset = usize::MAX / 2 + 1; + assert_layout(usize::MAX, 8, half, offset, (half + offset - 1) >> 1); + } + + #[test] + fn huge_width_and_tab_size() { + assert_layout(usize::MAX, usize::MAX, 0, usize::MAX, usize::MAX >> 1); + } + + #[test] + fn zero_width() { + assert_layout(0, 8, 0, 0, 0); + } + + #[test] + fn zero_tab_size_behaves_like_one() { + assert_layout(130, 0, 63, 67, 64); + assert_layout(130, 1, 63, 67, 64); + } + + #[track_caller] + fn assert_renders(from: &[u8], to: &[u8], width: usize, tabsize: usize) { + for expand_tabs in [false, true] { + let params = Params { + width, + tabsize, + expand_tabs, + ..Default::default() + }; + let mut output = vec![]; + + diff(from, to, &mut output, ¶ms); + } + } + + #[test_case(0 ; "zero")] + #[test_case(1 ; "one")] + #[test_case(2 ; "two")] + #[test_case(7 ; "odd")] + #[test_case(8 ; "default")] + #[test_case(1000 ; "wider than any line")] + #[test_case(usize::MAX / 2 ; "half of usize")] + #[test_case(usize::MAX - 1 ; "one below usize max")] + #[test_case(usize::MAX ; "usize max")] + fn extreme_tab_size_renders(tabsize: usize) { + for width in [0, 1, 2, 3, 5, 10, 40, 130, 1000, 65535] { + assert_renders(b"a\tb\n", b"a\tc\n", width, tabsize); + } + } + + #[test_case(b"aaa\tbbb\n", b"aaa\tccc\n" ; "tabs on both sides")] + #[test_case(b"\t\t\n", b"\n" ; "tabs against an empty line")] + #[test_case("\u{4f60}\u{597d}\t\u{1f600}\n".as_bytes(), b"a\n" ; "wide and multibyte")] + fn every_small_width_and_tab_size_renders(from: &[u8], to: &[u8]) { + for width in 0..96 { + for tabsize in 0..96 { + assert_renders(from, to, width, tabsize); + } + } + } + } + mod format_tabs_and_spaces { use super::*; @@ -1214,6 +1364,7 @@ mod tests { #[test] fn test_full_width_40_tab_8() { + // Expanded, so the layout uses a tab stop on every column. let config = create_config(40, 8, true); assert_eq!(config.sdiff_half_width, 16); assert_eq!(config.sdiff_column_two_offset, 24); From 6e21ff1d1c5eec97cc16f5dd5de27f15754fabda Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Wed, 12 Aug 2026 23:43:52 -0300 Subject: [PATCH 3/8] fix(side-diff): honour --expand-tabs in the column layout `Config::new` took `expanded` but ignored it when sizing the columns. The manual's "Preserving Tab Stop Alignment" section explains why it matters: column two has to start on a tab stop only so that tabs in the right column keep their position relative to the stops. With `--expand-tabs` there are no tabs left in the output, so there is no grid to preserve and every column is a stop. Compared against the output of `diff` from GNU diffutils 3.10. The separator column now matches it for `-y -t` at widths 40, 80 and 130, and for `-y -t --tabsize=4 --width=100`: columns 19, 39, 64 and 49. At the default width it sat on column 62 before, two columns off. The tab size still decides how far an expanded tab reaches, so it stays in the field and only `layout` sees the 1. Feeding the 1 into the field would shrink every expanded tab to a single space. The widened half line makes a crash reachable. A tab size near `usize::MAX` used to yield an empty half line, so `process_half_line` returned before drawing anything; with `-t` the line now fits and three expressions of the form `current_width + tab_size - (current_width % tab_size)` overflowed. `format_tabs_and_spaces` and the tab arm now measure the step to the next stop against the room that is left instead of summing absolute columns, which the surrounding `current_width <= max_width` already bounds. `test_full_width_40_tab_8` used `expanded = true` and expected the widths computed while ignoring it. The separator lands on column 19 either way, so only the half width and the offset change. The new tests were checked by mutation. Dropping the ternary breaks `expanded_tabs_widen_the_half_line`, `expanded_tabs_lay_out_as_a_stop_on_every_column` and `test_full_width_40_tab_8`; applying it to the field instead breaks `expanded_tabs_keep_the_real_tab_size_for_rendering` and `expanded_tabs_reach_the_next_real_tab_stop`. --- src/side_diff.rs | 135 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 117 insertions(+), 18 deletions(-) diff --git a/src/side_diff.rs b/src/side_diff.rs index e4fbf9d..584d981 100644 --- a/src/side_diff.rs +++ b/src/side_diff.rs @@ -76,7 +76,8 @@ impl Config { pub fn new(full_width: usize, tab_size: usize, expanded: bool) -> Self { let tab_size = tab_size.max(1); - let (half_width, column_two_offset) = Self::layout(full_width, tab_size); + let (half_width, column_two_offset) = + Self::layout(full_width, if expanded { 1 } else { tab_size }); Self { expanded, @@ -143,10 +144,15 @@ fn format_tabs_and_spaces( return Ok(()); } - while current + (tab_size - current % tab_size) <= to { - let next_tab = current + (tab_size - current % tab_size); + loop { + let advance = tab_size - current % tab_size; + + if advance > to - current { + break; + } + buf.write_all(b"\t")?; - current = next_tab; + current += advance; } while current < to { @@ -215,17 +221,18 @@ fn process_half_line( match char { b"\t" => { - if expanded && (current_width + tab_size - (current_width % tab_size)) <= max_width - { - let mut spaces = tab_size - (current_width % tab_size); - while spaces > 0 { - buf.write_all(b" ")?; - current_width += 1; - spaces -= 1; + let advance = tab_size - current_width % tab_size; + + if advance <= max_width - current_width { + if expanded { + for _ in 0..advance { + buf.write_all(b" ")?; + } + } else { + buf.write_all(b"\t")?; } - } else if current_width + tab_size - (current_width % tab_size) <= max_width { - buf.write_all(b"\t")?; - current_width += tab_size - (current_width % tab_size); + + current_width += advance; } } b"\n" => { @@ -399,7 +406,44 @@ mod tests { column_two_offset: usize, separator_pos: usize, ) { - let config = Config::new(full_width, tab_size, false); + assert_config( + full_width, + tab_size, + false, + half_width, + column_two_offset, + separator_pos, + ); + } + + #[track_caller] + fn assert_layout_expanded( + full_width: usize, + tab_size: usize, + half_width: usize, + column_two_offset: usize, + separator_pos: usize, + ) { + assert_config( + full_width, + tab_size, + true, + half_width, + column_two_offset, + separator_pos, + ); + } + + #[track_caller] + fn assert_config( + full_width: usize, + tab_size: usize, + expanded: bool, + half_width: usize, + column_two_offset: usize, + separator_pos: usize, + ) { + let config = Config::new(full_width, tab_size, expanded); assert_eq!(config.sdiff_half_width, half_width, "half width"); assert_eq!( @@ -414,6 +458,61 @@ mod tests { assert_layout(130, 8, 61, 64, 62); } + #[test] + fn expanded_tabs_lay_out_as_a_stop_on_every_column() { + assert_layout(130, 1, 63, 67, 64); + assert_layout_expanded(130, 8, 63, 67, 64); + assert_layout_expanded(130, usize::MAX, 63, 67, 64); + } + + #[test] + fn expanded_tabs_widen_the_half_line() { + assert_layout(130, 8, 61, 64, 62); + assert_layout_expanded(130, 8, 63, 67, 64); + + assert_layout(40, 8, 16, 24, 19); + assert_layout_expanded(40, 8, 18, 22, 19); + } + + #[test] + fn expanded_tabs_keep_the_real_tab_size_for_rendering() { + assert_eq!(Config::new(130, 8, true).tab_size, 8); + assert_eq!(Config::new(130, 8, false).tab_size, 8); + } + + #[test] + fn expanded_tabs_reach_the_next_real_tab_stop() { + let params = Params { + width: 40, + tabsize: 8, + expand_tabs: true, + ..Default::default() + }; + let mut output = vec![]; + + diff(b"a\tb\n", b"a\tc\n", &mut output, ¶ms); + + assert!(!output.contains(&b'\t'), "expanded output still has tabs"); + assert!( + output.starts_with(b"a b"), + "tab did not reach column 8" + ); + } + + #[test] + fn unexpanded_tabs_stay_tabs() { + let params = Params { + width: 40, + tabsize: 8, + ..Default::default() + }; + let mut output = vec![]; + + diff(b"a\tb\n", b"a\tc\n", &mut output, ¶ms); + + assert!(output.starts_with(b"a\tb")); + } + #[test] fn common_widths() { assert_layout(80, 8, 37, 40, 38); @@ -1366,9 +1465,9 @@ mod tests { fn test_full_width_40_tab_8() { // Expanded, so the layout uses a tab stop on every column. let config = create_config(40, 8, true); - assert_eq!(config.sdiff_half_width, 16); - assert_eq!(config.sdiff_column_two_offset, 24); - assert_eq!(config.separator_pos, 19); // (16 +24 -1) /2 = 19.5 + assert_eq!(config.sdiff_half_width, 18); + assert_eq!(config.sdiff_column_two_offset, 22); + assert_eq!(config.separator_pos, 19); // (18 + 22 - 1) / 2 = 19.5 } #[test] From de42d46d766aac99f191fd06e26b03aaad853790 Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Wed, 12 Aug 2026 23:44:09 -0300 Subject: [PATCH 4/8] test(fuzz): fuzz width and tabsize in the side-by-side target `width` and `tabsize` were commented out of `fuzz_side`, along with a `width == 0 || tabsize == 0` early return that was commented out too, because the column arithmetic could not take arbitrary values. It can now, so both are fed to the target and neither guard is needed. They are `u16` rather than `usize`: the layout handles the whole range, but a width near `usize::MAX` asks the renderer for petabytes of padding, which would only produce timeouts. --- fuzz/fuzz_targets/fuzz_side.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fuzz/fuzz_targets/fuzz_side.rs b/fuzz/fuzz_targets/fuzz_side.rs index 45580ef..95c4cee 100644 --- a/fuzz/fuzz_targets/fuzz_side.rs +++ b/fuzz/fuzz_targets/fuzz_side.rs @@ -8,16 +8,12 @@ use diffutilslib::params::Params; use std::fs::{self, File}; use std::io::Write; -fuzz_target!(|x: (Vec, Vec, /* usize, usize */ bool)| { - let (original, new, /* width, tabsize, */ expand) = x; - - // if width == 0 || tabsize == 0 { - // return; - // } +fuzz_target!(|x: (Vec, Vec, u16, u16, bool)| { + let (original, new, width, tabsize, expand) = x; let params = Params { - // width, - // tabsize, + width: width as usize, + tabsize: tabsize as usize, expand_tabs: expand, ..Default::default() }; From 1f4ed9f8747ef42a07787e7fe95b1d646b84b116 Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Thu, 13 Aug 2026 00:31:05 -0300 Subject: [PATCH 5/8] test(side-diff): drop the comment on the expanded layout expectation The assertions state the widths already, and the surrounding test name carries the tab size. --- src/side_diff.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/side_diff.rs b/src/side_diff.rs index 584d981..2a208e8 100644 --- a/src/side_diff.rs +++ b/src/side_diff.rs @@ -1463,7 +1463,6 @@ mod tests { #[test] fn test_full_width_40_tab_8() { - // Expanded, so the layout uses a tab stop on every column. let config = create_config(40, 8, true); assert_eq!(config.sdiff_half_width, 18); assert_eq!(config.sdiff_column_two_offset, 22); From 2c45eda55b207b7fd9fdc433e63d7120dfad58a2 Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Thu, 13 Aug 2026 00:43:18 -0300 Subject: [PATCH 6/8] test(side-diff): cover the carriage return padding at the widest line A carriage return pads all the way to column two, the only caller that reaches the far end of the line. That walk used to add absolute columns and overflowed with `--width` and `--tabsize` at the top of the range, which aborts under `-C overflow-checks=on`. Both values sit at the maximum on purpose: a smaller tab size walks to that end one stop at a time, and a smaller width never reaches the sum that overflowed. Expansion stays off, since it pads with spaces one column at a time and would not finish at this width. --- src/side_diff.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/side_diff.rs b/src/side_diff.rs index 2a208e8..7e60e8a 100644 --- a/src/side_diff.rs +++ b/src/side_diff.rs @@ -604,6 +604,19 @@ mod tests { } } + #[test] + fn carriage_return_at_the_widest_line_and_tab_size() { + let params = Params { + width: usize::MAX, + tabsize: usize::MAX, + expand_tabs: false, + ..Default::default() + }; + let mut output = vec![]; + + diff(b"a\rb\n", b"c\n", &mut output, ¶ms); + } + #[test_case(b"aaa\tbbb\n", b"aaa\tccc\n" ; "tabs on both sides")] #[test_case(b"\t\t\n", b"\n" ; "tabs against an empty line")] #[test_case("\u{4f60}\u{597d}\t\u{1f600}\n".as_bytes(), b"a\n" ; "wide and multibyte")] From dd1a9517f317a4ee78e808fede3cce80e0574ba5 Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Thu, 13 Aug 2026 00:53:07 -0300 Subject: [PATCH 7/8] test(fuzz): fuzz the whole tab size range in the side-by-side target A tab size wider than the line collapses the layout to a single column and draws nothing, so the whole `usize` range costs no more than a small one. Capping it at `u16` left out the values above `isize::MAX`, which are the ones the old signed arithmetic turned negative. The width stays a `u16`, since the padding it asks for is written one column at a time and the cost scales with it. --- fuzz/fuzz_targets/fuzz_side.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fuzz/fuzz_targets/fuzz_side.rs b/fuzz/fuzz_targets/fuzz_side.rs index 95c4cee..69d62aa 100644 --- a/fuzz/fuzz_targets/fuzz_side.rs +++ b/fuzz/fuzz_targets/fuzz_side.rs @@ -8,12 +8,17 @@ use diffutilslib::params::Params; use std::fs::{self, File}; use std::io::Write; -fuzz_target!(|x: (Vec, Vec, u16, u16, bool)| { +// We can't fuzz with width equals to usize, otherwise we +// would could have 2⁶⁴ - 1 of padding columns, which means +// exabytes nescessary for this. u32 also doesn't have a +// great perfomance here, with almost 537 MB being nescessary +// and 57 seconds of execution. +fuzz_target!(|x: (Vec, Vec, u16, usize, bool)| { let (original, new, width, tabsize, expand) = x; let params = Params { width: width as usize, - tabsize: tabsize as usize, + tabsize, expand_tabs: expand, ..Default::default() }; From d13692016ce6625358eb9cb281d930ff5fffdd9c Mon Sep 17 00:00:00 2001 From: Sami Daniel Date: Thu, 13 Aug 2026 00:54:49 -0300 Subject: [PATCH 8/8] style(fuzz): write the exponent in the width comment as ASCII Superscript digits do not survive every terminal or editor the file gets read in. --- fuzz/fuzz_targets/fuzz_side.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzz/fuzz_targets/fuzz_side.rs b/fuzz/fuzz_targets/fuzz_side.rs index 69d62aa..3fddb94 100644 --- a/fuzz/fuzz_targets/fuzz_side.rs +++ b/fuzz/fuzz_targets/fuzz_side.rs @@ -9,7 +9,7 @@ use std::fs::{self, File}; use std::io::Write; // We can't fuzz with width equals to usize, otherwise we -// would could have 2⁶⁴ - 1 of padding columns, which means +// would could have 2^64 - 1 of padding columns, which means // exabytes nescessary for this. u32 also doesn't have a // great perfomance here, with almost 537 MB being nescessary // and 57 seconds of execution.