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· +41 −1 · 1 files · 3 commits · openFix #2412: Export address validation now uses checked_sub() instead of wrapping_sub(), preventing potential overflow when an export address is below image_base or exceeds u32::MAX.
Changes:
Added test accepts_export_address_at_u32_max verifying that an export address at u32::MAX is accepted.
@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).
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.