Throw if word count of SPIR-V instruction is 0.
Avoids infinite loop on garbage SPIR-V files.
This commit is contained in:
parent
cc3aba52ba
commit
416566bab6
@ -30,6 +30,10 @@ Instruction::Instruction(const vector<uint32_t> &spirv, uint32_t &index)
|
||||
{
|
||||
op = spirv[index] & 0xffff;
|
||||
count = (spirv[index] >> 16) & 0xffff;
|
||||
|
||||
if (count == 0)
|
||||
throw CompilerError("SPIR-V instructions cannot consume 0 words. Invalid SPIR-V file.");
|
||||
|
||||
offset = index + 1;
|
||||
length = count - 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user