uutils / coreutils

Cross-platform Rust rewrite of the GNU coreutils

Home Page:https://uutils.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fmt: Crashes for some inputs (?)

BenWiederhake opened this issue · comments

$ yes a | head -n50 > 50a.txt
$ fmt -w 75 -g 10 50a.txt 
a a a a a a
a a a a a a a
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
$ cargo run -q fmt -w 75 -g 10 50a.txt 
thread 'main' panicked at 'attempt to subtract with overflow', src/uu/fmt/src/linebreak.rs:242:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
a[$? = 101]

I have no idea why it crashes here. It seems to crash for any "goal" of 37 or less.

Might be related to #5162, might not.