import_call_sites: count call sites for delay-loaded imports #464

Manually merged
github merged 1 commit from gh-pr/464/head into gh-pr/464/base 2026-11-26 09:01:52 +00:00
Owner

@⁠EdenBendheim on GitHub · 2026-11-24 05:49 UTC · original
EdenBendheim:ubiq/import-call-sites-delay-imports → main · +219 −41 · 3 files · 1 commits · merged 2026-11-24 08:53 UTC

Claim: #14

What changed

  • tools/pe_inspect.py: Share the bounded descriptor parser (import_descriptors) with tools/import_call_sites.py and add optional va_entries support in thunk_names() for legacy VA delay-import lookup entries while keeping pe_inspect's own output unchanged.
  • tools/import_call_sites.py: Enumerate PE32+ delay-loaded import IAT slots (named and ordinal, RVA and legacy VA descriptors) alongside ordinary imports, preserving tuple-based DLL/name matching (including in unmatched_selectors). Requires positive, mapped szName, pIAT, and pINT RVAs; ordinary imports take precedence on slot collisions.
  • tests/test_import_call_sites.py: Synthetic PE32+ tests covering RVA/VA descriptors, named/ordinal delay imports, ordinary-import coexistence and collisions, missing/underflowed pINT, RVA-0 DLL-name rejection, and truncated tables.

Testing & Disclosure

  • AI-assisted: Implemented with Codex (gpt-6.2-sol) and reviewed with Codex (gpt-6.2-astra).
  • Environment: macOS 27.3, Apple M1 Max, Python 3.14.3 (CPU-only, synthetic fixtures, zero game data).
  • Verified on ubiquitarianism/leonida main (8f481cf16): test_import_call_sites.py (21/21), test_pe_inspect.py (59 passed, 1 Windows-only skip), compileall, check_no_game_data.py, LF check — all passed.
**@⁠EdenBendheim** on GitHub · 2026-11-24 05:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/464) `EdenBendheim:ubiq/import-call-sites-delay-imports` → `main` · +219 −41 · 3 files · 1 commits · merged 2026-11-24 08:53 UTC Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### What changed - **`tools/pe_inspect.py`**: Share the bounded descriptor parser (`import_descriptors`) with `tools/import_call_sites.py` and add optional `va_entries` support in `thunk_names()` for legacy VA delay-import lookup entries while keeping `pe_inspect`'s own output unchanged. - **`tools/import_call_sites.py`**: Enumerate PE32+ delay-loaded import IAT slots (named and ordinal, RVA and legacy VA descriptors) alongside ordinary imports, preserving tuple-based DLL/name matching (including in `unmatched_selectors`). Requires positive, mapped `szName`, `pIAT`, and `pINT` RVAs; ordinary imports take precedence on slot collisions. - **`tests/test_import_call_sites.py`**: Synthetic PE32+ tests covering RVA/VA descriptors, named/ordinal delay imports, ordinary-import coexistence and collisions, missing/underflowed `pINT`, RVA-0 DLL-name rejection, and truncated tables. ### Testing & Disclosure - **AI-assisted:** Implemented with Codex (`gpt-6.2-sol`) and reviewed with Codex (`gpt-6.2-astra`). - **Environment:** macOS 27.3, Apple M1 Max, Python 3.14.3 (CPU-only, synthetic fixtures, zero game data). - **Verified on `ubiquitarianism/leonida` `main` (`8f481cf16`):** `test_import_call_sites.py` (21/21), `test_pe_inspect.py` (59 passed, 1 Windows-only skip), `compileall`, `check_no_game_data.py`, LF check — all passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:01:52 +00:00
github manually merged commit aa7223ecfa into gh-pr/464/base 2026-11-26 09:01:52 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 08:53 UTC · original

Merging. Why merged: delay-loaded imports are now counted, and descriptor parsing is shared in pe_inspect (not a translator input).
Why it's good: security-reviewed; on main 1c93c86: import/pe_inspect tests 78 -> 88 (9 fail without the fix); repo-consistency set 563/563.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 08:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/464#issuecomment-7126685931) Merging. Why merged: delay-loaded imports are now counted, and descriptor parsing is shared in pe_inspect (not a translator input). Why it's good: security-reviewed; on main 1c93c86: import/pe_inspect tests 78 -> 88 (9 fail without the fix); repo-consistency set 563/563. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.