tooling: check the capture reader and reject damaged captures #1264
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1271"
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-24T06:23:04Z.
What
tests/startup_capture_check.py: builds syntheticcapture.binfiles withstruct.pack, laid out like the writer insrc/startup_stubs/d3d12_capture.inl(FRAM, CALL, MEM, PSO, ROOT, RES, HEAP, OBJ, VIEW, TABL with and without id data, TGTS, PRES), loads them withCaptureand asserts every decoded field. It also checksMemory.read(latest block at or before a sequence, older bytes for an earlier sequence,Nonebefore any capture, an address inside a block, and today's behaviour for a read past the end of a block: the shorter bytes come back without an error) and thatdescribe()runs and names the expected slots, views, targets and present.tools/startup/capture.py: the reader now raisesValueErrornaming the tag and offset for a truncated header or body, an unknown tag, and a chunk header shorter than its struct. Before, a short last body was accepted silently, an unknown tag raisedAttributeError, and a trailing partial header was ignored. The dead first statement inon_RES.desc()(... if False else (None,) * 11) is removed. It was dead code, not a skipped decode: the console and desktop descriptions were already decoded correctly by the lines after it.CMakeLists.txtregisters cteststartup_capturenext to the other pure-Python startup checks (INTAKE_PYTHONblock);docs/startup-runtime.mdgets a short section with the test command.Why
The reader had no source-built check. I compared every
on_*method with the writer structs (offsets, widths, pad fields, data sizes) and found no layout mismatch; the checks keep it that way. Refs #1149Tested
Linux, run from the repository root:
All pass. Against the old
capture.pythe new check fails (the truncated-file case). The Windows ctest was not run locally:ctest --preset dev --no-tests=error -R '^startup_capture$' -V.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:26:32Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at
c3b18721:--preset dev): 21/21 PASS (8.59s), includingstartup_capture(0.09s) andstartup_stubs(0.48s)/O2(--preset release): 21/21 PASS (8.30s), includingstartup_capture(0.09s) andstartup_stubs(0.37s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:26:39Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
c3b1872ℹ️ 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.