Loader: write IAT slots as bytes, so an IAT at an odd RVA is not UB (debug builds aborted at load) #260
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!260
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-260"
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?
@sharan104 on GitHub · 2026-11-26 13:33 UTC · original
sharan104:fix/iat-slot-alignment→main· +39 −3 · 1 files · 1 commits · openwindows.rswrite_slotspatched IAT slots withwrite_volatilethrough a*mut u64. Its SAFETY comment said the slots are "8-byte aligned by the PE format", but the format doesn't require that, and the parser doesn't check it. A title image whose IAT sits at an odd RVA is undefined behaviour, and a debug build aborts at load with "ptr::write_volatile requires that the pointer argument is aligned".Fix: the slot is written as
[u8; 8](little-endian), still volatile, so no alignment is assumed. The SAFETY comment now says so.Test:
an_unaligned_iat_slot_is_writtenwrites two misaligned slots, one of them across a page boundary, into read-only pages, the same as an image's import table. Before the fix it aborted; after it, it passes (10 runs out of 10).Results:
cargo test -p victory-loader --lockedpasses.-D warningsis clean, apart fromdescriptor_sites.rs:277, which is already failing onmainand which #169 fixes.🤖 Generated with 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.