From 71763c84c2fa8f1585cf433f6cfb424265930e04 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 5 Oct 2021 19:19:26 +0000 Subject: [PATCH] Update remaining fuzzers to use TransforBuilder Missed some fuzzers in my last fix, because I was trying to git grep between repos... This should fix any outstanding issues with NULL being passed into SetTransformManager in TintCommonFuzzer. BUG=chromium:1255313 Change-Id: Idf71bc34bb75041accec303df3da0bc6f9cd15cc Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/65940 Auto-Submit: Ryan Harrison Reviewed-by: Ben Clayton Kokoro: Kokoro Commit-Queue: Ryan Harrison --- fuzzers/tint_ast_fuzzer/fuzzer.cc | 8 ++++---- fuzzers/tint_regex_fuzzer/fuzzer.cc | 8 ++++---- fuzzers/tint_robustness_fuzzer.cc | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/fuzzers/tint_ast_fuzzer/fuzzer.cc b/fuzzers/tint_ast_fuzzer/fuzzer.cc index ca60cf8a04..b6b238f6f6 100644 --- a/fuzzers/tint_ast_fuzzer/fuzzer.cc +++ b/fuzzers/tint_ast_fuzzer/fuzzer.cc @@ -20,6 +20,7 @@ #include "fuzzers/tint_ast_fuzzer/mutator.h" #include "fuzzers/tint_ast_fuzzer/override_cli_params.h" #include "fuzzers/tint_common_fuzzer.h" +#include "fuzzers/transform_builder.h" #include "src/reader/wgsl/parser.h" #include "src/writer/wgsl/generator.h" @@ -109,13 +110,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { continue; } - transform::Manager transform_manager; - transform::DataMap transform_inputs; - transform_manager.Add(); + TransformBuilder tb(data, size); + tb.AddTransform(); CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format); fuzzer.EnableInspector(); - fuzzer.SetTransformManager(&transform_manager, &transform_inputs); + fuzzer.SetTransformManager(tb.manager(), tb.data_map()); fuzzer.Run(data, size); if (fuzzer.HasErrors()) { diff --git a/fuzzers/tint_regex_fuzzer/fuzzer.cc b/fuzzers/tint_regex_fuzzer/fuzzer.cc index 1de67c7524..0a557501d4 100644 --- a/fuzzers/tint_regex_fuzzer/fuzzer.cc +++ b/fuzzers/tint_regex_fuzzer/fuzzer.cc @@ -21,6 +21,7 @@ #include "fuzzers/tint_regex_fuzzer/cli.h" #include "fuzzers/tint_regex_fuzzer/override_cli_params.h" #include "fuzzers/tint_regex_fuzzer/wgsl_mutator.h" +#include "fuzzers/transform_builder.h" #include "src/reader/wgsl/parser.h" #include "src/writer/wgsl/generator.h" @@ -137,13 +138,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { continue; } - transform::Manager transform_manager; - transform::DataMap transform_inputs; - transform_manager.Add(); + TransformBuilder tb(data, size); + tb.AddTransform(); CommonFuzzer fuzzer(InputFormat::kWGSL, target.output_format); fuzzer.EnableInspector(); - fuzzer.SetTransformManager(&transform_manager, &transform_inputs); + fuzzer.SetTransformManager(tb.manager(), tb.data_map()); fuzzer.Run(data, size); } diff --git a/fuzzers/tint_robustness_fuzzer.cc b/fuzzers/tint_robustness_fuzzer.cc index e0296bb5d5..16eec00410 100644 --- a/fuzzers/tint_robustness_fuzzer.cc +++ b/fuzzers/tint_robustness_fuzzer.cc @@ -14,16 +14,17 @@ #include "fuzzers/fuzzer_init.h" #include "fuzzers/tint_common_fuzzer.h" +#include "fuzzers/transform_builder.h" namespace tint { namespace fuzzers { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - tint::transform::Manager transform_manager; - transform_manager.Add(); + TransformBuilder tb(data, size); + tb.AddTransform(); tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kWGSL); - fuzzer.SetTransformManager(&transform_manager, {}); + fuzzer.SetTransformManager(tb.manager(), tb.data_map()); fuzzer.SetDumpInput(GetCliParams().dump_input); return fuzzer.Run(data, size);