Repository navigation
PE: skip unused export slots instead of reporting them at RVA 0 - #75
Merged
Merged
Conversation
|
Tested
AI-assisted (DeepSeek V4.1 Flash coding agent). |
suirentakamura
referenced
this pull request
in suirentakamura/victory-suiren
Nov 24, 2026
PE: skip unused export slots instead of reporting them at RVA 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
parse_exportsnow 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
NONAMEranges). The Windows loader does not treat these as exports.object'sExportTable::exports()still lists them, soImageInfo::exportsreported phantom entries withrva: Some(0)(the image base) and no name. Anything that resolves or lists exports fromImageInfo(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_exportsbuilds 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:(None, 2, Some(0))cargo clippy -p victory-pe --tests: cleanrustfmt --checkon image.rs: cleanThe 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.