pe_inspect: parse and validate PE export forwarders table #45

Closed
Andretuta wants to merge 1 commit from upstream-pr/45 into main
Andretuta commented 2026-11-24 02:06:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:06:57Z.


Carried over from old PR 9768 by abnalstlll-byte in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9768, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
abnalstlll-byte: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Parse and validate PE export forwarders in tools/pe_inspect.py.

What and why

PE exports can contain forwarder RVAs pointing into other DLLs. This change:

  • Parses export forwarder strings within the export directory bounds.
  • Validates export forwarder RVAs against the pe_loader contract.
  • Adds comprehensive unit test coverage in tests/test_pe_inspect.py (69/69 pass).

Verification

  • python -I tests/test_pe_inspect.py -> 69/69 pass.
  • python -I scripts/check_no_game_data.py -> clean (zero game data).
  • git diff --check -> clean.
  • Python standard library only, Windows / cross-platform compatible.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464709718 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/45). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:06:57Z. --- > Carried over from **old PR 9768** by `abnalstlll-byte` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9768`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `abnalstlll-byte`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Parse and validate PE export forwarders in `tools/pe_inspect.py`. ### What and why PE exports can contain forwarder RVAs pointing into other DLLs. This change: - Parses export forwarder strings within the export directory bounds. - Validates export forwarder RVAs against the `pe_loader` contract. - Adds comprehensive unit test coverage in `tests/test_pe_inspect.py` (69/69 pass). ### Verification - `python -I tests/test_pe_inspect.py` -> 69/69 pass. - `python -I scripts/check_no_game_data.py` -> clean (zero game data). - `git diff --check` -> clean. - Python standard library only, Windows / cross-platform compatible. AI-assisted.
abnalstlll-byte commented 2026-11-24 08:02:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T08:02:41Z.


Verified clean and ready for review: 69/69 tests pass under python -I tests/test_pe_inspect.py, zero game data, conforms to PE loader contract.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7125658935 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/45#issuecomment-7125658935). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T08:02:41Z. --- Verified clean and ready for review: 69/69 tests pass under python -I tests/test_pe_inspect.py, zero game data, conforms to PE loader contract.
MoonEyes commented 2026-11-27 19:44:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T19:44:29Z.


Thanks a lot for carrying this over, @Andretuta. #693, which @abnalstlll-byte opened to restore their own old PR 9768, starts with this draft's commit and adds three follow-up commits to tools/pe_inspect.py and tests/test_pe_inspect.py (pipe escaping, forwarder target checks, non-x64 machines). So everything in this draft is also in #693.

I am closing this draft so the review happens in one place. Please continue the discussion on #693, or reopen this one if you see something it misses.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226825077 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/45#issuecomment-7226825077). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T19:44:29Z. --- Thanks a lot for carrying this over, @Andretuta. #693, which @abnalstlll-byte opened to restore their own old PR 9768, starts with this draft's commit and adds three follow-up commits to `tools/pe_inspect.py` and `tests/test_pe_inspect.py` (pipe escaping, forwarder target checks, non-x64 machines). So everything in this draft is also in #693. I am closing this draft so the review happens in one place. Please continue the discussion on #693, or reopen this one if you see something it misses. AI-assisted (Claude Code, Claude Opus 5.5)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!45
No description provided.