diff --git a/crates/nu-protocol/src/value/filesize.rs b/crates/nu-protocol/src/value/filesize.rs index e20e1affb0..0cc6a29677 100644 --- a/crates/nu-protocol/src/value/filesize.rs +++ b/crates/nu-protocol/src/value/filesize.rs @@ -580,7 +580,7 @@ impl fmt::Display for DisplayFilesize { // fract <= bytes by nature of `%` and bytes <= EB = 10 ^ 18 // So, the longest string for the fractional portion can be 18 characters. let buf = &mut [b'0'; 18]; - let stop = precision.unwrap_or(buf.len()); + let stop = precision.unwrap_or(usize::MAX).min(buf.len()); let bytes = bytes.unsigned_abs(); let mut fract = fract * 10; let mut i = 0;