mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Regex fuzzer: Add return statement inside a randomly-chosen function
Adds a return statement in the body of a randomly-chosen function. The return value is a randomly-chosen identifier or literal from the WGSL shader. Fixes: tint:1115. Change-Id: Icdc4ff669cda343244e158ce791b4085fd52f7b9 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61781 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:
@@ -37,6 +37,7 @@ enum class MutationKind {
|
||||
kDuplicateInterval,
|
||||
kReplaceIdentifier,
|
||||
kReplaceLiteral,
|
||||
kInsertReturnStatement,
|
||||
kNumMutationKinds
|
||||
};
|
||||
|
||||
@@ -95,6 +96,12 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data,
|
||||
}
|
||||
break;
|
||||
|
||||
case MutationKind::kInsertReturnStatement:
|
||||
if (!InsertReturnStatement(wgsl_code, generator)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false && "Unreachable");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user