PE: skip unused export slots instead of reporting them at RVA 0 #75
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/75"
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?
Imported from Marvisak/VIctory. Originally posted by tedin7 on 2026-11-24T00:15:13Z.
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.
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:24:33Z.
Tested
9a5cbbestacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.cargo test --workspace: 156 passed, 0 failed, 3 ignored; merge with #39 clean.#[test]s for the export-address slots, included in that run.AI-assisted (DeepSeek V4.1 Flash coding agent).