Fix #2412: reject out-of-range export addresses in parse_exports #3280
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3280
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3280"
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?
@tharun-37 on GitHub · 2026-11-26 15:39 UTC · original
tharun-37:fix/ghidra-export-validation→main· +36 −2 · 1 files · 4 commits · openFix #2412:
parse_exportsnow converts export addresses to RVAs with checked subtraction and a fallibleu32conversion instead ofwrapping_sub+as.This is a defensive check:
objectcurrently supplies addresses asimage_base + rvawith a 32-bit RVA, so valid inputs are unaffected. Out-of-range addresses now returnPeError::Malformedinstead of wrapping/truncating.Added
keeps_valid_export_rva_when_image_base_is_highto verify valid RVAs are preserved with a high image base.@AurumCarlos on GitHub · 2026-11-26 15:41 UTC · original · reviewed
Thanks for splitting it out, the diff is now just the
parse_exportshunk. A few loose ends:rejects_export_address_below_image_base, but this PR adds no test. Either drop that line, or add a test that really feeds an out-of-range address (the old one passed on the valid path, see my note on #3165).objectgivesimage_base + rvawith a 32-bit RVA, so this can't trigger today. "Preventing integer overflow" would read better as a defensive check.rustfmtallows;cargo fmtshould reflow them.@Dukestar69 on GitHub · 2026-11-26 16:11 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64:
address.wrapping_sub(image_base) as u32withchecked_sub(image_base)+u32::try_fromcleanly rejects out-of-range export addresses withPeError::Malformedinstead of silently truncating/wrapping.cargo test -p victory-pe -- --test-threads=1: 36 passed, 0 failed.cargo clippy -p victory-pe --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@tharun-37 on GitHub · 2026-11-26 17:24 UTC · original
Addressed the review notes: replaced the misleading test with
keeps_valid_export_rva_when_image_base_is_high, reworded the description as a defensive check, and verified formatting. CI passes. Left #3165 untouched.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.