Repository navigation
fix(hle): saturate storage quota conversion - #337
CesarLopesO wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested PR #337 at head
Behavior covered: Checks storage quota conversion saturates when megabytes exceed the u64 byte range. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 6922a81 on Windows 11, RTX 5070, MSVC: victory-hle fails to compile:
error[E0689]: can't call method `saturating_mul` on ambiguous numeric type `{integer}`
--> crates\victory-hle\src\runtime.rs:104:52
|
104 | storage_bytes: storage_mb.unwrap_or(0).saturating_mul(1024 * 1024),
storage_mb.unwrap_or(0) leaves the literal's type undetermined at the point of the method call. Annotate it: storage_mb.unwrap_or(0u64).saturating_mul(1 << 20), or .map_or(0, |mb: u64| mb.saturating_mul(1 << 20)). With that, the saturating conversion and the boundary test look right.
The elements hunk is only rustfmt reflow of an unrelated line. Dropping it would keep the diff focused, especially since #359 also touches that function.
AI-assisted (Claude Code).
|
Updated the PR with the explicit Additional validation on Debian 13:
Native Linux test execution remains blocked by the unrelated Could you please review the updated commit? |
The manifest's SizeMB was shifted into bytes, which wraps for values at or above 2^44 instead of saturating, and the parse type was implicit. Applied as the net patch of upstream PR Marvisak#337 (head 5cf259e), squashing its four commits: 6922a81, f8071b1, c6ffada, 5cf259e. Its first commit alone did not compile, so the reviewed net diff is what was integrated. (cherry picked from PR Marvisak#337, source head 5cf259e)
mercuryVM
left a comment
There was a problem hiding this comment.
Re-tested 5cf259e on Windows 11, RTX 5070, MSVC: it now compiles, and cargo test -p victory-hle 88 passed, including storage_quota_saturates_when_megabytes_exceed_u64_bytes.
- This addresses my earlier review (E0689 on an unsuffixed
saturating_mul):parse::<u64>()fixes the integer type, sosaturating_mul(1024 * 1024)resolves, and aSizeMBaboveu64::MAX / 2^20givesu64::MAXinstead of wrapping as<< 20did. - The test pins both sides of the boundary, the exact limit and one past it.
- The entity-decoding hunk is a rustfmt reflow only.
AI-assisted (Claude Code).
|
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current). Saturates the SizeMB to bytes conversion, which only matters for a manifest quota above 2^44 MB; cannot occur. The rest is reformatting, and the test was never run (cross-compiled only). If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Summary
SizeMBvalues from silently overflowing during conversion.Validation
Test limitation
cargo test --locked -p victory-hle runtime::testscould not reach the tests on the current Linuxmainbranch because compilation fails first incrates/victory-gpu/src/resource.rswithE0425: cannot find function host_resource.This is the existing Linux build issue tracked in #90; related Linux compatibility changes are proposed separately in #235. This PR only changes
crates/victory-hle/src/runtime.rs.