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>
This commit is contained in:
Ben Clayton 2022-11-01 00:23:14 +00:00 committed by Dawn LUCI CQ
parent e689e053be
commit 3f24fdc447
1 changed files with 5 additions and 0 deletions

View File

@ -303,6 +303,11 @@ void CommonFuzzer::RunInspector(Program* program) {
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);