mirror of
https://github.com/nushell/nushell
synced 2025-01-12 13:19:01 +00:00
Fix index out of bounds
This commit is contained in:
parent
5d930ffcb2
commit
454bda6d90
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue