PE: keep every name for a shared export ordinal #555

Manually merged
github merged 1 commit from gh-pr/555/head into gh-pr/555/base 2026-11-26 04:08:11 +00:00
Owner

@⁠Quat3rnion on GitHub · 2026-11-24 04:50 UTC · original
Quat3rnion:victory-export-aliases → main · +79 −24 · 1 files · 1 commits · merged 2026-11-25 00:11 UTC

What

ImageInfo::parse used the PE-specific export table, which keeps one name
per address-table slot. When two names aliased one ordinal, the earlier name
was silently dropped from ImageInfo::exports and from victory inspect --exports. The generic Object::exports iterator yields every named export
(and then ordinal-only entries), so the parser now uses it and maps its
target and flags back to our representation. A synthetic PE with two names
for one ordinal plus a separate export covers the alias case.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 165 passed, 0 failed, 3 ignored. The new regression asserts all three names and their RVAs survive parsing.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
**@⁠Quat3rnion** on GitHub · 2026-11-24 04:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/555) `Quat3rnion:victory-export-aliases` → `main` · +79 −24 · 1 files · 1 commits · merged 2026-11-25 00:11 UTC ## What `ImageInfo::parse` used the PE-specific export table, which keeps one name per address-table slot. When two names aliased one ordinal, the earlier name was silently dropped from `ImageInfo::exports` and from `victory inspect --exports`. The generic `Object::exports` iterator yields every named export (and then ordinal-only entries), so the parser now uses it and maps its target and flags back to our representation. A synthetic PE with two names for one ordinal plus a separate export covers the alias case. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 165 passed, 0 failed, 3 ignored. The new regression asserts all three names and their RVAs survive parsing. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
The PE-specific export table stores one name per address-table slot, so when two names alias one ordinal the earlier name is silently dropped from ImageInfo and from victory inspect --exports. Use the generic Object::exports iterator instead, which yields every named export and then ordinal-only entries, and map its target and flags back to our representation. Add a synthetic PE regression with two names for one ordinal plus a separate export.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:08:10 +00:00
github manually merged commit d0dd9fc5c0 into gh-pr/555/base 2026-11-26 04:08:11 +00:00
Author
Owner

@⁠sebastianspicker on GitHub · 2026-11-24 11:02 UTC · original

Tested b71c252 applied onto main ffe310e (macOS, Rust 1.98.1).

  • The new test fails on main exactly as described: [("beta", 1, 0x1200), ("gamma", 2, 0x1204)], so "alpha" is dropped. It passes with the PR.
  • The old code filtered Address(0) slots itself. object 0.41's PeExportIterator still skips zero addresses in its ordinal-only pass (export.rs, address == 0 => continue), and unused_export_slots_are_not_exports still passes, so the gap handling isn't lost. The only difference is a named entry pointing at a zero slot, which is malformed anyway.
  • Exports now come name-first, then bare ordinals. The only consumer I found is victory inspect --exports, so that's cosmetic.
  • cargo clippy -p victory-pe --all-targets -D warnings: clean on macOS and for x86_64-pc-windows-msvc (with -p victory).

Looks good to me.

AI-assisted.

**@⁠sebastianspicker** on GitHub · 2026-11-24 11:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/555#issuecomment-7129569038) Tested `b71c252` applied onto `main` `ffe310e` (macOS, Rust 1.98.1). - The new test fails on `main` exactly as described: `[("beta", 1, 0x1200), ("gamma", 2, 0x1204)]`, so "alpha" is dropped. It passes with the PR. - The old code filtered `Address(0)` slots itself. `object` 0.41's `PeExportIterator` still skips zero addresses in its ordinal-only pass (`export.rs`, `address == 0 => continue`), and `unused_export_slots_are_not_exports` still passes, so the gap handling isn't lost. The only difference is a *named* entry pointing at a zero slot, which is malformed anyway. - Exports now come name-first, then bare ordinals. The only consumer I found is `victory inspect --exports`, so that's cosmetic. - `cargo clippy -p victory-pe --all-targets -D warnings`: clean on macOS and for `x86_64-pc-windows-msvc` (with `-p victory`). Looks good to me. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!555
No description provided.