tint/fuzzers: Don't run the inspector on invalid programs

docs/tint/arch.md states that:
> The input `Program` to the inspector must be valid (pass validation).

So it should not be assumed that the inspector can handle invalid programs.

Bug: chromium:1378999
Change-Id: I780f59ba1117f5eadb461a55947c8e36761ab25f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107688
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/fuzzers/tint_common_fuzzer.cc b/src/tint/fuzzers/tint_common_fuzzer.cc
index 9e12a12..1c24f35 100644
--- a/src/tint/fuzzers/tint_common_fuzzer.cc
+++ b/src/tint/fuzzers/tint_common_fuzzer.cc
@@ -303,6 +303,11 @@
     inspector::Inspector inspector(program);
     diagnostics_ = program->Diagnostics();
 
+    if (!program->IsValid()) {
+        // It's not safe to use the inspector on invalid programs.
+        return;
+    }
+
     auto entry_points = inspector.GetEntryPoints();
     CHECK_INSPECTOR(program, inspector);