mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-25 13:00:04 +00:00
spirv-fuzz: Fix in operand type assertion (#3666)
spvtools::fuzz::MakeIdUseDescriptorFromUse asserts if the id use type is SPV_OPERAND_TYPE_ID. The problem is that not all id types are covered by this condition. The bug was found because the first operand of an OpControlBarrier instruction has SPV_OPERAND_TYPE_SCOPE_ID as type. Therefore, to cover all cases the spvIsInIdType function is used. Fixes #3665.
This commit is contained in:
parent
f505538677
commit
fd3cabd8b5
@ -52,7 +52,7 @@ protobufs::IdUseDescriptor MakeIdUseDescriptorFromUse(
|
|||||||
opt::IRContext* context, opt::Instruction* inst,
|
opt::IRContext* context, opt::Instruction* inst,
|
||||||
uint32_t in_operand_index) {
|
uint32_t in_operand_index) {
|
||||||
const auto& in_operand = inst->GetInOperand(in_operand_index);
|
const auto& in_operand = inst->GetInOperand(in_operand_index);
|
||||||
assert(in_operand.type == SPV_OPERAND_TYPE_ID);
|
assert(spvIsInIdType(in_operand.type));
|
||||||
return MakeIdUseDescriptor(in_operand.words[0],
|
return MakeIdUseDescriptor(in_operand.words[0],
|
||||||
MakeInstructionDescriptor(context, inst),
|
MakeInstructionDescriptor(context, inst),
|
||||||
in_operand_index);
|
in_operand_index);
|
||||||
|
Loading…
Reference in New Issue
Block a user