fix(hle): saturate storage quota conversion #337

Closed
github-bot wants to merge 4 commits from gh-pr/337/head into gh-pr/337/base
Owner

@⁠CesarLopesO on GitHub · 2026-11-24 02:23 UTC · original
CesarLopesO:fix/runtime-storage-quota-overflow → main · +31 −5 · 1 files · 4 commits · closed without merging

Summary

  • Replace the left shift used to convert the manifest's persistent storage quota from MB to bytes with saturating multiplication.
  • Prevent oversized SizeMB values from silently overflowing during conversion.
  • Add a regression test covering the largest representable MB value and the first value above that limit.

Validation

  • rustfmt --edition 2024 --check crates/victory-hle/src/runtime.rs — passed
  • git diff --check — passed
  • cargo check --locked -p victory-hle --tests --target x86_64-pc-windows-gnu — passed
  • cargo test --locked -p victory-hle --no-run --target x86_64-pc-windows-gnu — passed

Test limitation

cargo test --locked -p victory-hle runtime::tests could not reach the tests on the current Linux main branch because compilation fails first in crates/victory-gpu/src/resource.rs with E0425: 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.

**@⁠CesarLopesO** on GitHub · 2026-11-24 02:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/337) `CesarLopesO:fix/runtime-storage-quota-overflow` → `main` · +31 −5 · 1 files · 4 commits · closed without merging ## Summary - Replace the left shift used to convert the manifest's persistent storage quota from MB to bytes with saturating multiplication. - Prevent oversized `SizeMB` values from silently overflowing during conversion. - Add a regression test covering the largest representable MB value and the first value above that limit. ## Validation - rustfmt --edition 2024 --check crates/victory-hle/src/runtime.rs — passed - git diff --check — passed - cargo check --locked -p victory-hle --tests --target x86_64-pc-windows-gnu — passed - cargo test --locked -p victory-hle --no-run --target x86_64-pc-windows-gnu — passed ## Test limitation `cargo test --locked -p victory-hle runtime::tests` could not reach the tests on the current Linux `main` branch because compilation fails first in `crates/victory-gpu/src/resource.rs` with `E0425: 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`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:49 +00:00
github-bot closed this pull request 2026-11-26 03:59:49 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:21 UTC · original

Tested PR #337 at head 6922a81d615f4e7a55b6f488a0dc704351568a13 (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at 6922a81d615f4e7a55b6f488a0dc704351568a13.

  • cargo test --locked -p victory-hle storage_quota_saturates_when_megabytes_exceed_u64_bytes — FAILED (exit 101); detail: error[E0689]: can't call method saturating_mul on ambiguous numeric type {integer} | error: could not compile victory-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

**@⁠jeremygold02** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/337#issuecomment-7121949625) Tested PR #337 at head `6922a81d615f4e7a55b6f488a0dc704351568a13` (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at `6922a81d615f4e7a55b6f488a0dc704351568a13`. - `cargo test --locked -p victory-hle storage_quota_saturates_when_megabytes_exceed_u64_bytes` — FAILED (exit 101); detail: error[E0689]: can't call method `saturating_mul` on ambiguous numeric type `{integer}` | error: could not compile `victory-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](https://github.com/Marvisak/VIctory/blob/6922a81d615f4e7a55b6f488a0dc704351568a13/crates/victory-hle/src/runtime.rs)
Author
Owner

@⁠CesarLopesO on GitHub · 2026-11-24 10:57 UTC · original

Updated the PR with the explicit u64 parsing 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.
  • Windows GNU cross-compilation with cargo check --tests — passed.
  • cargo test --no-run for victory-hle on the Windows GNU target — passed; test binaries were compiled successfully, but not executed.

Native Linux test execution remains blocked by the unrelated host_resource E0425 error in victory-gpu (#90).

Could you please review the updated commit?

**@⁠CesarLopesO** on GitHub · 2026-11-24 10:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/337#issuecomment-7129468751) Updated the PR with the explicit `u64` parsing 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. - Windows GNU cross-compilation with `cargo check --tests` — passed. - `cargo test --no-run` for `victory-hle` on the Windows GNU target — passed; test binaries were compiled successfully, but not executed. Native Linux test execution remains blocked by the unrelated `host_resource` E0425 error in `victory-gpu` (#90). Could you please review the updated commit?
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:02 UTC · original

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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/337#issuecomment-7148067623) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!337
No description provided.