[tint][ir][fuzz] Handle malformed StoreVectorElement in validator
- Removes unused `CheckOperandsNotNull`
Issue: 345196551
Fixes: 355451180
Change-Id: I37ea66c826c66bf3a0e5174b2413d0a0ead651e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/200061
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index a932edc..0406d33 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -364,15 +364,6 @@
// TODO(345196551): Remove this override once it is no longer used.
void CheckOperandNotNull(const ir::Instruction* inst, const ir::Value* operand, size_t idx);
- /// Checks all operands in the given range (inclusive) for @p inst are not null
- /// @param inst the instruction
- /// @param start_operand the first operand to check
- /// @param end_operand the last operand to check
- // TODO(345196551): Remove this override once it is no longer used.
- void CheckOperandsNotNull(const ir::Instruction* inst,
- size_t start_operand,
- size_t end_operand);
-
/// Validates the root block
/// @param blk the block
void CheckRootBlock(const Block* blk);
@@ -911,16 +902,6 @@
}
}
-// TODO(353498500): Remove this function once it is no longer used.
-void Validator::CheckOperandsNotNull(const Instruction* inst,
- size_t start_operand,
- size_t end_operand) {
- auto operands = inst->Operands();
- for (size_t i = start_operand; i <= end_operand; i++) {
- CheckOperandNotNull(inst, operands[i], i);
- }
-}
-
void Validator::CheckRootBlock(const Block* blk) {
block_stack_.Push(blk);
TINT_DEFER(block_stack_.Pop());
@@ -1871,9 +1852,10 @@
}
void Validator::CheckStoreVectorElement(const StoreVectorElement* s) {
- CheckOperandsNotNull(s, //
- StoreVectorElement::kToOperandOffset,
- StoreVectorElement::kValueOperandOffset);
+ if (!CheckResultsAndOperands(s, StoreVectorElement::kNumResults,
+ StoreVectorElement::kNumOperands)) {
+ return;
+ }
if (auto* value = s->Value()) {
if (auto* el_ty = GetVectorPtrElementType(s, StoreVectorElement::kToOperandOffset)) {