pe_map: reject reserved bits in ordinary named import thunks #1614

Merged
tedin7 merged 1 commit from upstream-pr/1621 into main 2026-11-24 17:47:22 +00:00
tedin7 commented 2026-11-24 15:09:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:09:04Z.


Summary

  • Reject non-zero reserved bits (31..62) in ordinary PE32+ named import thunks in tools/pe_map.cpp instead of masking them with 0x7fffffff.
  • Aligns ordinary import thunk validation with the existing delay-import thunk check in tools/pe_map.cpp so high-bit garbage cannot alias a valid low RVA.
  • Add negative test cases in tests/cpu/native_map_check.py verifying that setting bit 31 or bit 32 on an ordinary named import thunk fails mapping with MAP_FORMAT (import name for ... outside image).

Verification

  • git diff --check origin/main...HEAD
  • python3 tests/docs_links_check.py (16 Markdown files, 348 links)
  • python3 tests/bidi_controls_check.py (1262 files)
  • Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit ec5ee282b441a3c7f5bf2b68c9865bdf1906684b:
    • Debug (--preset dev): cpu_native_map + cpu_native_mutation 2/2 passed (5.55s)
    • Release /O2 (--preset release): cpu_native_map + cpu_native_mutation 2/2 passed (5.51s)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584914504 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1621). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:09:04Z. --- ## Summary - Reject non-zero reserved bits (31..62) in ordinary PE32+ named import thunks in `tools/pe_map.cpp` instead of masking them with `0x7fffffff`. - Aligns ordinary import thunk validation with the existing delay-import thunk check in `tools/pe_map.cpp` so high-bit garbage cannot alias a valid low RVA. - Add negative test cases in `tests/cpu/native_map_check.py` verifying that setting bit 31 or bit 32 on an ordinary named import thunk fails mapping with `MAP_FORMAT` (`import name for ... outside image`). ## Verification - `git diff --check origin/main...HEAD` - `python3 tests/docs_links_check.py` (16 Markdown files, 348 links) - `python3 tests/bidi_controls_check.py` (1262 files) - Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `ec5ee282b441a3c7f5bf2b68c9865bdf1906684b`: - Debug (`--preset dev`): `cpu_native_map` + `cpu_native_mutation` **2/2 passed** (`5.55s`) - Release `/O2` (`--preset release`): `cpu_native_map` + `cpu_native_mutation` **2/2 passed** (`5.51s`) AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 16:03:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T15:15:02Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T15:17:00.023155Z ec5ee28 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135707220 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1621#issuecomment-7135707220). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T15:15:02Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"ec5ee282b441a3c7f5bf2b68c9865bdf1906684b","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T15:17:00.023155Z">2026-11-24T15:17:00.023155Z</relative-time> | `ec5ee28` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
upstream-sync closed this pull request 2026-11-24 18:02:19 +00:00
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
R0Y00/Xbox2Windows!1614
No description provided.