cpu: guard short data-directory tables and executable flag in cpu_exe_aot #240
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!240
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/240/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Vonsek on GitHub · 2026-11-21 18:59 UTC · original
Vonsek:ag/cpu-exe-header-guards→main· +51 −3 · 3 files · 1 commits · merged 2026-11-21 19:12 UTCChange
Fix two PE32+ header checks in
tools/cpu_exe_aot.py(translate):len(pe.OPTIONAL_HEADER.DATA_DIRECTORY) > 9before reading the TLS directory slot, so valid PE32+ executables withNumberOfRvaAndSizes <= 9do not crash withIndexError;IMAGE_FILE_EXECUTABLE_IMAGE(FILE_HEADER.Characteristics & 2), matchingtools/intake_exe.py.Adds
check_header_guardstotests/cpu/exe_entry_check.py(passingcpu_exe_ioandcpu_import_providerfromCMakeLists.txt), testing patched copies of the source-builtcpu_exe_original.exe:NumberOfRvaAndSizes = 4) positive control that must translate identically to the unpatched executable;VirtualAddress,IMAGE_FILE_DLLset, andIMAGE_FILE_EXECUTABLE_IMAGEcleared.Verification
Tested on Windows 11 x64, VS 2022 Build Tools 17.14 (MSVC 19.44.35230.0, ML64 14.44.35230.0), Windows SDK 10.0.26100, Python 3.12.10 (
pefile==2024.8.26,iced-x86==1.21.0), at commit69400db:tools/cpu_exe_aot.py,cpu_aot_exe_entryfails on the 4-directory case:Evidence and follow-up
All new checks operate on patched temporary copies of the existing source-built
cpu_exe_original.exewithout loading or executing the mutated copies.The entry profile's supported instructions, frame bounds, and TLS exclusion remain unchanged.
Checklist
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 19:02 UTC · original · edited 2026-11-21 19:04 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
69400dbℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.