Disable size assertions in SPIR-V Tools fuzzer
The SPIR-V Tools fuzzer asserts that the binaries it receives have sizes that are multiples of 4 bytes, as it should only ever run on valid binaries. This is failing in ClusterFuzz, likely due to the fuzzer being misconfigured, so for now these assertions have been replaced with early exits. They should be reinstated once the fuzzer is correctly configured. Fixes: chromium:1232308 Change-Id: I1fa980d09ce9e5c349a2cfcebe0246ebad6613fb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/59440 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Auto-Submit: Alastair Donaldson <afdx@google.com>
This commit is contained in:
parent
ba93d14c9a
commit
bd3edb564f
|
@ -100,10 +100,13 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* data,
|
|||
size_t size,
|
||||
size_t max_size,
|
||||
unsigned seed) {
|
||||
assert((size % 4) == 0 &&
|
||||
"A valid SPIR-V binary's size must be a multiple of 4, and the "
|
||||
"SPIR-V Tools fuzzer should only work with valid binaries. Check that "
|
||||
"the fuzzer has been correctly configured.");
|
||||
if ((size % 4) != 0) {
|
||||
// A valid SPIR-V binary's size must be a multiple of 4, and the SPIR-V
|
||||
// Tools fuzzer should only work with valid binaries.
|
||||
// TODO(afdx): Change this to an assertion once sure that this fuzzer is
|
||||
// configured correctly in ClusterFuzz.
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> binary(size / sizeof(uint32_t));
|
||||
std::memcpy(binary.data(), data, size);
|
||||
|
@ -175,11 +178,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
assert((size % 4) == 0 &&
|
||||
"By design, the SPIR-V Tools fuzzer should only ever test using valid "
|
||||
"SPIR-V binaries, whose sizes should be multiples of 4 bytes. Check "
|
||||
"that the fuzzer has been configured correctly, with a corpus of "
|
||||
"valid SPIR-V binaries, and with only the custom mutator enabled.");
|
||||
if ((size % 4) != 0) {
|
||||
// By design, the SPIR-V Tools fuzzer should only ever test using valid
|
||||
// SPIR-V binaries, whose sizes should be multiples of 4 bytes.
|
||||
// TODO(afdx): Change this to an assertion once sure that this fuzzer is
|
||||
// configured correctly in ClusterFuzz.
|
||||
return 0;
|
||||
}
|
||||
|
||||
CommonFuzzer spv_to_wgsl(InputFormat::kSpv, OutputFormat::kWGSL);
|
||||
spv_to_wgsl.EnableInspector();
|
||||
|
|
Loading…
Reference in New Issue