mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Regex fuzzer: replace the value of an integer with
a value in the set {INT_MAX, INT_MIN, -1 or 0}.
A mutation that replaces the value of a randomly-chosen integer with a value
in the set {INT_MAX, INT_MIN, -1, 0}.
Fixes: tint:1093.
Change-Id: I5ec69e1813785760ed6e7b06d0cbd9c481f69ade
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/60920
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:
@@ -35,6 +35,8 @@ enum class MutationKind {
|
||||
kSwapIntervals,
|
||||
kDeleteInterval,
|
||||
kDuplicateInterval,
|
||||
kReplaceIdentifier,
|
||||
kReplaceLiteral,
|
||||
kNumMutationKinds
|
||||
};
|
||||
|
||||
@@ -78,6 +80,18 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data,
|
||||
}
|
||||
break;
|
||||
|
||||
case MutationKind::kReplaceIdentifier:
|
||||
if (!ReplaceRandomIdentifier(wgsl_code, generator)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case MutationKind::kReplaceLiteral:
|
||||
if (!ReplaceRandomIntLiteral(wgsl_code, generator)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false && "Unreachable");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user