fix(hle): saturate storage quota conversion #337
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/337"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by CesarLopesO on 2026-11-24T02:23:27Z.
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.Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:21:51Z.
Tested PR #337 at head
6922a81d615f4e7a55b6f488a0dc704351568a13(state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at6922a81d615f4e7a55b6f488a0dc704351568a13.cargo test --locked -p victory-hle storage_quota_saturates_when_megabytes_exceed_u64_bytes— FAILED (exit 101); detail: error[E0689]: can't call methodsaturating_mulon ambiguous numeric type{integer}| error: could not compilevictory-hle(lib) due to 1 previous error.Behavior covered: Checks storage quota conversion saturates when megabytes exceed the u64 byte range.
Code: crates/victory-hle/src/runtime.rs
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T08:21:56Z.
Review: CHANGES_REQUESTED
Tested
6922a81on Windows 11, RTX 5070, MSVC:victory-hlefails to compile: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
elementshunk 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).
Imported from Marvisak/VIctory. Originally posted by CesarLopesO on 2026-11-24T10:57:36Z.
Updated the PR with the explicit
u64parsing fix and the rustfmt adjustments.Additional validation on Debian 13:
rustfmt --edition 2024 --check crates/victory-hle/src/runtime.rs— passed.git diff --check— passed.cargo check --tests— passed.cargo test --no-runforvictory-hleon the Windows GNU target — passed; test binaries were compiled successfully, but not executed.Native Linux test execution remains blocked by the unrelated
host_resourceE0425 error invictory-gpu(#90).Could you please review the updated commit?
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T12:56:20Z.
Review: APPROVED
Re-tested
5cf259eon Windows 11, RTX 5070, MSVC: it now compiles, andcargo test -p victory-hle88 passed, includingstorage_quota_saturates_when_megabytes_exceed_u64_bytes.saturating_mul):parse::<u64>()fixes the integer type, sosaturating_mul(1024 * 1024)resolves, and aSizeMBaboveu64::MAX / 2^20givesu64::MAXinstead of wrapping as<< 20did.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:02:17Z.
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.
Pull request closed