mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Fix generation of random indices in regex fuzzer
Random indices were being generated in a manner that assumed the upper bound to a Random::GetUInt call was inclusive. Also, GetUInt64 was being used needlessly when GetUInt32 would suffice. This change addresses both issues. Fixes https://crbug.com/1250904 Change-Id: I9ad8e5beb3b52bcb867aeb745dec520c251cba60 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64744 Auto-Submit: Alastair Donaldson <afdx@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Alastair Donaldson <afdx@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
1d81f83704
commit
0118b964f3
@@ -59,10 +59,10 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data,
|
||||
RandomGenerator generator(seed);
|
||||
|
||||
std::string delimiter =
|
||||
delimiters[generator.GetUInt64(delimiters.size() - 1u)];
|
||||
delimiters[generator.GetUInt32(static_cast<uint32_t>(delimiters.size()))];
|
||||
|
||||
MutationKind mutation_kind = static_cast<MutationKind>(generator.GetUInt64(
|
||||
static_cast<size_t>(MutationKind::kNumMutationKinds) - 1u));
|
||||
MutationKind mutation_kind = static_cast<MutationKind>(generator.GetUInt32(
|
||||
static_cast<uint32_t>(MutationKind::kNumMutationKinds)));
|
||||
|
||||
switch (mutation_kind) {
|
||||
case MutationKind::kSwapIntervals:
|
||||
|
||||
Reference in New Issue
Block a user