Loader: fix thunk block overflow, capacity enforcement, flush errors, and leaks #1306
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1306"
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 geiyiliyabumo on 2026-11-24T17:17:49Z.
Summary
Audits \crates/victory-loader/src/thunks.rs\ and fixes 4 bugs:
Verification
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T17:26:40Z.
Review: APPROVED
Tested head
29d78ba(fast-forward onmainffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):cargo test -p victory-loader: 26 unit + 2load_probe+ 1title_dllspassed, 0 failed (includingcapacity_matches_the_requested_slot_count,overflowing_slot_counts_fail_before_allocation, andunpublished_blocks_release_the_reservation)cargo clippy -p victory-loader --all-targets: 0 warningscargo xtask policy: okSolid thunk-block overflow, capacity, flush, and cleanup fixes. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:34:55Z.
Automated triage for the maintainers.
The four fixes in
crates/victory-loader/src/thunks.rsdo not address failures that can happen on main.ThunkBlock::newis called only fromLoadedImage::bind_importsinwindows.rs, behindif !unresolved.is_empty(). So the count is never zero, andcount * 32cannot overflow for an import list. On main, the page-rounded capacity only allows more slots than requested, never fewer, soemitcannot overrun. The newDropfrees memory only on error paths wherebind_importsreturnsErrand the image is never run. On x64,FlushInstructionCachefailing is not a realistic case. The stub-encoding test is reasonable on its own, but it checks the bytes the code already writes.If you have a case where one of these paths is reached, please describe it and push a change; a small PR adding only the encoding/round-trip test would also be welcome. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the
triage: proposed closelabel. No CI ran on this head.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.