[PR #464] [MERGED] import_call_sites: count call sites for delay-loaded imports #516

Closed
opened 2026-11-26 20:18:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/464
Author: @EdenBendheim
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: ubiq/import-call-sites-delay-imports


📝 Commits (1)

  • aa7223e Count call sites for delay-loaded imports

📊 Changes

3 files changed (+219 additions, -41 deletions)

View changed files

📝 tests/test_import_call_sites.py (+157 -1)
📝 tools/import_call_sites.py (+26 -12)
📝 tools/pe_inspect.py (+36 -28)

📄 Description

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123316122

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/464 **Author:** [@EdenBendheim](https://github.com/EdenBendheim) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `ubiq/import-call-sites-delay-imports` --- ### 📝 Commits (1) - [`aa7223e`](https://github.com/ubiquitarianism/leonida/commit/aa7223ecfac4ac9d7ef06553f0c72e719baf852c) Count call sites for delay-loaded imports ### 📊 Changes **3 files changed** (+219 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_import_call_sites.py` (+157 -1) 📝 `tools/import_call_sites.py` (+26 -12) 📝 `tools/pe_inspect.py` (+36 -28) </details> ### 📄 Description Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7123316122 ### 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:08 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#516
No description provided.