linker: reject modules too small to hold a SPIR-V header #6977
All Vouch review confidence checks passed
Residual risk 0.03 = Change Risk (0.23) × (1 − Review Confidence (0.89)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.23 · 21 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.185
Real PR Conversation Timeline
3 items
 <br/>Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.<br/><sub>You have signed the CLA already but the status is still pending? Let us recheck it.</sub>
Approved
LGTM. Please sign the CLA
dneto0
Hsnmohd
spvtools::Link(source/link/linker.cpp) readsbinaries[i][SPV_INDEX_SCHEMA](header word 4) for every input module before any check that the module is even five words long;binary_sizes[i]is only consulted later insideBuildModule.spirv-linkbuilds each module withReadBinaryFile, which happily returns a one-word vector for a 4-byte file (and a null/zero-length buffer for an empty one), so a module shorter than the SPIR-V header triggers a heap out-of-bounds read (empty input is a null-pointer deref). Reject inputs with fewer thanSPV_INDEX_INSTRUCTIONwords up front, where the raw buffer is first touched.ASan on
spirv-linkbefore the fix, with a 4-byte file (just the magic number):After:
error: 1: Module 1 is too small to hold a SPIR-V header.(empty input likewise rejected). Added a regression test in test/link/binary_version_test.cpp that fails on the pre-fix tree.