pe: locate the TLS directory by VirtualAddress in intake_exe #171
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/172"
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 Vonsek on 2026-11-21T17:55:54Z.
Change
Locate the PE32+ TLS directory by
VirtualAddressalone intools/intake_exe.py(inspect_executable), matching the Windows loader andpe_map.Previously,
inspect_executablerejected any image withDATA_DIRECTORY[9].VirtualAddress != 0andSize < 40, as well as any image withVirtualAddress == 0andSize != 0, withIncomplete TLS directory. As verified against Windows incpu_native_tls, the loader ignores the TLS directorySizefield: a nonzeroVirtualAddresswithSize0 or 39 still runs TLS callbacks, andVirtualAddress == 0with nonzeroSizehas no TLS directory.inspect_executablenow reads the 40-byteIMAGE_TLS_DIRECTORY64wheneverVirtualAddress != 0, with full section andSizeOfImagebounds checking viaread_rva(d.VirtualAddress, 40).tests/intake/check.pyadds four cases on patched copies of the source-builtintake_candidate.exe:Size = 0andSize = 39with nonzeroVirtualAddresspreservepe.tlsandpe.startup.locations;VirtualAddress = 0withSize = 40reportspe.tls = Noneand only the entry point inpe.startup.locations;VirtualAddress = SizeOfImage - 16withSize = 0is rejected with an RVA bounds error.Verification
Tested on Windows 11 x64, VS 2022 Build Tools 17.14 (MSVC 19.44.35230.0), Windows SDK 10.0.26100, Python 3.12.10 (
pefile==2024.8.26), at commit29fa4bf:tools/intake_exe.py,static_exe_intakefails on theSize = 0case:Evidence and follow-up
All new cases patch copies of the existing source-built
intake_candidate.exein a temporary directory without loading or executing the fixture.The Windows loader behavior for
Size0/1/39,VirtualAddress == 0, and out-of-bounds TLS directories is already cross-checked live intests/cpu/native_tls_check.py(cpu_native_tls).Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T17:58:20Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
29fa4bfℹ️ 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.