Commit 494ebd6
fix: validate SPIR-V magic number in shader_build to prevent Vulkan hang
Passing GLSL text with a SPIRV encoding caused buildShader to silently
create a corrupt shader module. When shader_replace later called
ReplaceResource → RefreshDerivedReplacements → vkCreateGraphicsPipelines
with the invalid SPIR-V, the Vulkan driver would hang indefinitely,
crashing the MCP server process.
Add magic number (0x07230203) and minimum size validation for SPIRV and
OpenGLSPIRV encodings, returning a clear error message that suggests
using GLSL encoding instead.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent ef29edb commit 494ebd6
1 file changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
147 | 174 | | |
148 | 175 | | |
149 | 176 | | |
| |||
0 commit comments