Repository navigation
shader_meta: reject incomplete DXBC input signatures - #4572
Conversation
|
Tested head
The DXBC input signature validation rejects incomplete signatures as described. AI-assisted (Devin). |
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 6f447e78 on Windows 11: python -I tests/test_shader_meta.py -> 20 tests, OK; git diff --check clean.
An ISG1 table whose declared elements run past the chunk is now dropped whole (input_signature absent) instead of publishing the prefix; the entity offset must also be at least 8, so a table cannot point back into its own header. The added cases cover count=2 with the payload of one element and offset=0, and keep the unrelated SFI0 flags. No blocking issue.
|
Tested 6f447e7 merged with main d0835dd (merge f448d43c1, no conflicts) on Linux (WSL2) Python 3.12.16 and native Windows 11 Python 3.13.1: pass.
|
Flyander
left a comment
There was a problem hiding this comment.
The element-table bounds check is sound, but malformed semantic-name offsets still produce and publish a partial signature.
| end = p.find(b"\x00", noff) | ||
| if end > noff: | ||
| semantic = p[noff:end].decode("ascii", "replace") | ||
| elems.append({ |
There was a problem hiding this comment.
[P2] If NameOffset is out of range, points into the element table, or has no terminating NUL, this code leaves semantic empty or decodes unrelated bytes and still appends the element. That publishes a malformed input_signature instead of rejecting it. The semantic name is part of the signature contract: Microsoft describes SemanticName as the per-parameter string that identifies data use, and signature compatibility requires exact semantics (https://learn.microsoft.com/en-us/windows/win32/api/d3d11shader/ns-d3d11shader-d3d11_signature_parameter_desc). Please validate every name offset/terminator against the string area and omit the whole signature if any entry is invalid.
|
Verdict: approve-with-nits.
Verified: Also checked for regression: the full Nits:
AI-assisted review. |
|
Tested 2b53baf merged with main 98fa503 on Linux (Python 3.12.16): pass - tests/test_shader_meta.py 21 OK, tests/test_docs_*.py (10 files) OK; negative control: upstream/main tools/shader_meta.py with the new tests: 5 failures. The new docs sentence checks out against the runtime: an empty input_signature makes layout_feeds() in runtime/shims/d3d12_vulkan_device.cpp return true for any layout. No issue found. |
|
Merged cleanly with current main: all 21 shader-metadata tests and the docs guards (repo paths, cli flags, table ids) pass under python -I. The synthetic containers correctly demonstrate that malformed tables or name offsets drop the whole signature without losing unrelated SFI0 metadata. The #3634 overlap is only on docs/d3d12_vulkan.md and main already carries that table cleanup via adea815 — unrelated to ISG1. No CI checks were reported. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Claimed in the coordination issue as: New BUILD item
What and why
Validate the DXBC ISG1 element table in
tools/shader_meta.pybefore publishinginput_signature. Previously, a truncated table could publish a partial signature, and an offset inside the chunk header could cause the header to be read as an element.The metadata reader now omits the input signature when the table is invalid. It still reports feature flags from a valid SFI0 chunk.
Tested
python3 -I tests/test_shader_meta.py— all 20 tests passed on Linux. Both malformed-table cases failed before the fix.spirv-valwere outside the scope of this metadata change.AI-assisted (Codex).
Checklist
docs/design.md, with how it was confirmed. (N/A — this change validates build-time metadata.)