mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Regex fuzzer: Change the region boundaries
Changes the interval boundaries to exclude the first delimiter that encloses a region. Change-Id: Ia9186e584d9038b4220cad11d418fa9881e51e8d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60346 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Alastair Donaldson <afdx@google.com> Commit-Queue: Alastair Donaldson <afdx@google.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "fuzzers/tint_common_fuzzer.h"
|
||||
#include "fuzzers/tint_regex_fuzzer/cli.h"
|
||||
|
||||
#include "fuzzers/tint_regex_fuzzer/util.h"
|
||||
#include "fuzzers/tint_regex_fuzzer/wgsl_mutator.h"
|
||||
|
||||
#include "src/reader/wgsl/parser.h"
|
||||
@@ -52,13 +52,12 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data,
|
||||
std::string wgsl_code(data, data + size);
|
||||
const std::vector<std::string> delimiters{";"};
|
||||
std::mt19937 generator(seed);
|
||||
std::string delimiter = delimiters[std::uniform_int_distribution<size_t>(
|
||||
0, delimiters.size() - 1)(generator)];
|
||||
|
||||
MutationKind mutation_kind =
|
||||
static_cast<MutationKind>(std::uniform_int_distribution<size_t>(
|
||||
0,
|
||||
static_cast<size_t>(MutationKind::kNumMutationKinds) - 1)(generator));
|
||||
std::string delimiter =
|
||||
delimiters[GetRandomIntFromRange(0, delimiters.size() - 1, generator)];
|
||||
|
||||
MutationKind mutation_kind = static_cast<MutationKind>(GetRandomIntFromRange(
|
||||
0, static_cast<size_t>(MutationKind::kNumMutationKinds) - 1, generator));
|
||||
|
||||
switch (mutation_kind) {
|
||||
case MutationKind::kSwapIntervals:
|
||||
|
||||
Reference in New Issue
Block a user