Skip to content

PE: skip unused export slots instead of reporting them at RVA 0 - #75

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
tedin7:vic-pe-export-holes
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
tedin7:vic-pe-export-holes

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What

parse_exports now skips export address-table slots whose address is 0.

Why

An address of 0 marks an unused slot (a gap in the ordinals, as in DLLs built with holes or NONAME ranges). The Windows loader does not treat these as exports. object's ExportTable::exports() still lists them, so ImageInfo::exports reported phantom entries with rva: Some(0) (the image base) and no name. Anything that resolves or lists exports from ImageInfo (e.g. victory inspect) would see them. Forwarded exports are unaffected (a forwarder address is always inside the export directory, never 0).

Tested

New unit test unused_export_slots_are_not_exports builds a synthetic in-memory PE32+ (no game or retail data) with ordinal base 1 and three slots: "alpha", a hole, "gamma".

Linux x86_64, cargo test -j4 -p victory-pe:

  • before the fix, the new test FAILS: left has 3 entries including (None, 2, Some(0))
  • after the fix, the new test passes
  • cargo clippy -p victory-pe --tests: clean
  • rustfmt --check on image.rs: clean

The 4 existing tests that parse the host executable (parses_own_test_binary, rva_to_file_offset_maps_entry_point, rejects_iat_outside_image, dump_tls) fail on Linux because the host is an ELF binary. This is pre-existing and unrelated to this change.

Not run: Windows runtime and GPU.

@DaviTostes

Copy link
Copy Markdown

Tested 9a5cbbe stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.

AI-assisted (DeepSeek V4.1 Flash coding agent).

@Marvisak
Marvisak merged commit bf6c557 into Marvisak:main Nov 24, 2026
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
PE: skip unused export slots instead of reporting them at RVA 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants