WIP: pe_inspect: parse and validate PE export forwarders table #45

Closed
leonida/mandy
Andretuta wants to merge 0 commits from old-pr/9768 into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Andretuta commented 2026-11-24 02:06:57 +00:00

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.

> 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

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.

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

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)

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)
Sign in to join this conversation.
No description provided.