From 25b7d4064f635d3b857eed02d7d463460e53ecf6 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 27 May 2021 17:05:47 +0000 Subject: [PATCH] reader/spirv: Handle parser error MaybeEmitCombinatorialValue() didn't check that MakeOperand() or RectifySecondOperandSignedness() didn't error, leading to ICEs. Bug: crbug.com/tint/804 Change-Id: Ic78487a70a591e718c7b5936c6678e7a19c4b626 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51927 Commit-Queue: Ben Clayton Auto-Submit: Ben Clayton Kokoro: Kokoro Reviewed-by: David Neto --- src/reader/spirv/function.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 0987f536de..7ded27d8aa 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -3510,6 +3510,9 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue( auto arg0 = MakeOperand(inst, 0); auto arg1 = parser_impl_.RectifySecondOperandSignedness( inst, arg0.type, MakeOperand(inst, 1)); + if (!arg0 || !arg1) { + return {}; + } auto* binary_expr = create(Source{}, binary_op, arg0.expr, arg1.expr); TypedExpression result{ast_type, binary_expr};