Skip to content

Commit

Permalink
spirv-fuzz: Fix in operand type assertion (#3666)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andreperezmaselco authored Aug 11, 2020
1 parent f505538 commit fd3cabd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/fuzz/id_use_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protobufs::IdUseDescriptor MakeIdUseDescriptorFromUse(
opt::IRContext* context, opt::Instruction* inst,
uint32_t 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],
MakeInstructionDescriptor(context, inst),
in_operand_index);
Expand Down

0 comments on commit fd3cabd

Please sign in to comment.