shader: reject DXIL VBR operands above 64 bits #460
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/466"
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 agilesh08 on 2026-11-22T05:27:52Z.
## Change
In
tools/dxil_retarget.py,BitReader.read_vbr()checked whether cumulativeshift > 64only after shifting and or-ing the incoming payload chunks intovalue. If a malformed or adversarial bitstream supplied a multi-chunk VBR operand whose highest payload bits crossed the 64-bit boundary duringshift <= 64, Python's arbitrary-precision integers allowedvalueto silently exceeduint64_t.This change:
payload.bit_length() > 64 - shiftbefore shifting each piece, raisingValueError("VBR integer exceeds 64 bits")immediately when an operand exceeds 64 bits.tests/dxil_retarget_check.pyfor boundary values (0,1,(1 << 64) - 1) and negative controls asserting rejection for1 << 64and(1 << 65) - 1.Verification
Run on Windows x64 with Python 3.14 (
D:\Xbox2Windows\.venv\Scripts\python.exe):Output:
Full platform-independent suite (20 checks including
docs_links_check.pyandbidi_controls_check.py):Result: All 20 checks passed with exit code 0.
Evidence and follow-up
All fixtures are 100% synthetic in-memory bitstream payloads generated dynamically using
BitWriter.This change is AI-assisted.
Checklist