Fix out-of-bounds unit index in GetHumanSize
codexReview effort 1/5aardvark
### Motivation
`GetHumanSize` can increment the unit index beyond the bounds of `SizeNames` when the input size is >= `1024^5`. When formatting daemon-controlled `leftUntilDone` values, this can trigger a range-check exception and crash the client, resulting in a client-side denial of service.
### Description
- Change the loop condition in `GetHumanSize` from `while i <= High(SizeNames) do` to `while i < High(SizeNames) do`.
- Stop scaling at the largest supported unit while preserving the existing output format and rounding behavior.
### Testing
- Verified boundary behavior for `1024^5 - 1`, `1024^5`, infinity, and non-default `RoundTo` values.
- Confirmed that the resulting unit index remains within the valid `SizeNames` range.
合并状态:未合并 6 条评论