spirv-reader: check conversion of a result type

Bug: chromium:1230976
Change-Id: I793e437f298be3f34a80da7b43ee779fc122e6a8
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62921
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: David Neto <dneto@google.com>
diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc
index f5dcc36..77c0d84 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -3523,6 +3523,9 @@
     TypedExpression combinatorial_expr;
     if (def_info->skip == SkipReason::kDontSkip) {
       combinatorial_expr = MaybeEmitCombinatorialValue(inst);
+      if (!success()) {
+        return false;
+      }
     }
     // An access chain or OpCopyObject can generate a skip.
     if (def_info->skip != SkipReason::kDontSkip) {
@@ -3813,8 +3816,14 @@
 
   const auto opcode = inst.opcode();
 
-  const Type* ast_type =
-      inst.type_id() != 0 ? parser_impl_.ConvertType(inst.type_id()) : nullptr;
+  const Type* ast_type = nullptr;
+  if (inst.type_id()) {
+    ast_type = parser_impl_.ConvertType(inst.type_id());
+    if (!ast_type) {
+      Fail() << "couldn't convert result type for: " << inst.PrettyPrint();
+      return {};
+    }
+  }
 
   auto binary_op = ConvertBinaryOp(opcode);
   if (binary_op != ast::BinaryOp::kNone) {