pe: bound intake section spans by VirtualSize #760
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!760
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/760/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?
@FZNull on GitHub · 2026-11-23 01:22 UTC · original
FZNull:fix/intake-virtual-size→main· +99 −6 · 2 files · 2 commits · merged 2026-11-23 02:02 UTCProblem
tools/intake_exe.pybounded RVA placement and the TLS callback slot count bySizeOfRawData. A section whoseMisc.VirtualSizeexceeds itsSizeOfRawDatamaps a zero-filled tail, and the Windows loader treats the section span asMisc.VirtualSize(tools/pe_map.cpp:95). A TLS directory or a callback-table terminator placed in that tail was rejected as unmapped or truncated, and the slot count stopped at the raw end.Reproduction against the source-built
intake_forward_caller.exe(.data:VirtualAddress0xc000,Misc_VirtualSize0x2b9,SizeOfRawData0x200) with the TLS directory at RVA 0xc200:Change
section_for()and the TLS callback slot bound useMisc_VirtualSize(falling back toSizeOfRawDatawhen it is zero, clamped toSizeOfImage), matching the loader.read_rva()reads the file-backed prefix and zero-fills the rest of a request from the uninitialized virtual tail; a short file-backed prefix still raisesTruncated data at RVA ....One behavior, no unrelated changes.
Test
tests/intake/check.pygainscheck_virtual_tail_tls(). It extends the last section'sVirtualSizepast its raw data so the tail exists under either linker layout (Debug and Release lay the fixtures out differently), then checks:Unmapped or unsuitable RVA ...);VirtualSizestops claiming the tail.The new test fails on
main(Unterminated TLS callback table or inspection limit reached) and passes with the fix, on bothdevandrelease.Verification
Environment: Windows 11, Python 3.13.12 (
out/pe-env, pefile 2024.8.26), MSVC 19.50.35726, Windows SDK 10.0.26100.0, CMake 4.5.1 + Ninja.Before the fix the issue reproduction exited 1 with
ValueError: Unmapped or unsuitable RVA 0xc200; after the fix it exits 0 and the intake report lists the parsed TLS callbacks. This is fixture evidence for the loader-bound behavior, not full-game startup evidence.Fixes #744