cpu: AOT tools refuse malformed PE input with a message #1626
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1633"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:28:43Z.
AI-assisted; commands listed were executed locally.
Two malformed-input crashes in the AOT command-line tools, one commit each.
tools/cpu_ranges.py:function_rangesindexedDATA_DIRECTORY[3]without checking NumberOfRvaAndSizes. An image with fewer than four directories endedcpu_leaf_aot,cpu_call_aotandcpu_chained_aotwith an IndexError traceback. It now raises a ValueError that the tools already print as one line.tools/cpu_exe_aot.py: the only translator whose command line did not catch OSError, ValueError and PEFormatError. A missing image or an unsupported image ended with a traceback. It now prints the reason and exits with status 1 like the other three.New test
tests/cpu/malformed_pe_check.pybuilds a small synthetic DLL (tests/cpu/synthetic_pe.py, no real binary) and checks a complete image translates (control), a short directory table is refused by the three tools, and the EXE tool refuses a missing image and a DLL image, each with exit status 1, a message and no traceback. Registered ascpu_aot_malformed_pe.Commands executed locally (Linux, Python 3.14, pefile 2024.8.26, iced-x86):
python -B tests/cpu/malformed_pe_check.py: fails on origin/main (IndexError traceback, then the FileNotFoundError traceback), passes after each fix.python -B tests/docs_links_check.py: passed (16 Markdown files, 348 links).python -B tests/bidi_controls_check.py: passed (1267 tracked files).git diff origin/main --check: clean.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
c81475419871b9a4daf344c31e2ef54bf086ce2c:--preset dev):cmake --build --preset dev --target cpu_leaf_original_lifted cpu_call_original_lifted cpu_chained_lifted -- -j 6):3.04s(configure1.73s)ctest --preset dev -R '^(cpu_aot_malformed_pe|cpu_leaf_aot_branches)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (1.41s:cpu_leaf_aot_branches0.10s,cpu_aot_malformed_pe1.34s)/O2(--preset release):cmake --build --preset release --target cpu_leaf_original_lifted cpu_call_original_lifted cpu_chained_lifted -- -j 6):0.42s(configure1.78s)ctest --preset release -R '^(cpu_aot_malformed_pe|cpu_leaf_aot_branches)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (1.34s:cpu_leaf_aot_branches0.10s,cpu_aot_malformed_pe1.26s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T15:40:41Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
c814754ℹ️ 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.