PE: reject out-of-range export addresses in parse_exports instead of wrapping #2412
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#2412
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@pushkarreddyy on GitHub · 2026-11-25 13:07 UTC · original
Summary
In
crates/victory-pe/src/image.rs(parse_exports), export RVAs are reconstructed fromobject'sReadTarget::Address { address }using:If a malformed PE export address is below
image_baseoraddress - image_base > u32::MAX,wrapping_sub+as u32silently wraps/truncates into a bogus 32-bit RVA instead of returningPeError::Malformed.Expected
Use
checked_sub(image_base)andu32::try_from, returningPeError::Malformedon out-of-range export addresses.Claiming this issue and opening a PR with unit tests shortly.
@Marvisak on GitHub · 2026-11-25 15:45 UTC · original
Automated triage for the maintainers.
Read against main (
da82e44): incrates/victory-pe/src/image.rs,parse_exports, the addressobject(0.41) hands back is the image base plus the 32-bit RVA stored in the export address table.address.wrapping_sub(image_base) as u32undoes exactly that sum, so it always recovers the original table value; an export address below the image base or more thanu32::MAXpast it cannot arise from a PE file. What the table holds can still point outside the image, butchecked_sub/try_fromwould not detect that; it would need a check against the image size. PR #2420 (open) makes the change described here.Generated by Claude Code