Skip to content

spirv-fuzz: Operands are not removed in correct order in TransformationReplaceParamsWIthStruct #3629

@Vasniktel

Description

@Vasniktel

Elements in indices_of_replaced_params are not sorted.

for (auto it = indices_of_replaced_params.rbegin();
it != indices_of_replaced_params.rend(); ++it) {
// +1 since the first in operand to OpFunctionCall is the result id of
// the function.
inst->RemoveInOperand(*it + 1);
}

The elements in the vector are shifted to the left when some element is removed. This means that if we remove an element with index i, every element with index j >= i previously had an index j + 1. Thus, the transformation might remove incorrect operands from OpFunctionCall instruction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions