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 size,
|
||||||
size_t max_size,
|
size_t max_size,
|
||||||
unsigned seed) {
|
unsigned seed) {
|
||||||
assert((size % 4) == 0 &&
|
if ((size % 4) != 0) {
|
||||||
"A valid SPIR-V binary's size must be a multiple of 4, and the "
|
// A valid SPIR-V binary's size must be a multiple of 4, and the SPIR-V
|
||||||
"SPIR-V Tools fuzzer should only work with valid binaries. Check that "
|
// Tools fuzzer should only work with valid binaries.
|
||||||
"the fuzzer has been correctly configured.");
|
// 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::vector<uint32_t> binary(size / sizeof(uint32_t));
|
||||||
std::memcpy(binary.data(), data, size);
|
std::memcpy(binary.data(), data, size);
|
||||||
|
@ -175,11 +178,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((size % 4) == 0 &&
|
if ((size % 4) != 0) {
|
||||||
"By design, the SPIR-V Tools fuzzer should only ever test using valid "
|
// 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 "
|
// SPIR-V binaries, whose sizes should be multiples of 4 bytes.
|
||||||
"that the fuzzer has been configured correctly, with a corpus of "
|
// TODO(afdx): Change this to an assertion once sure that this fuzzer is
|
||||||
"valid SPIR-V binaries, and with only the custom mutator enabled.");
|
// configured correctly in ClusterFuzz.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
CommonFuzzer spv_to_wgsl(InputFormat::kSpv, OutputFormat::kWGSL);
|
CommonFuzzer spv_to_wgsl(InputFormat::kSpv, OutputFormat::kWGSL);
|
||||||
spv_to_wgsl.EnableInspector();
|
spv_to_wgsl.EnableInspector();
|
||||||
|
|
Loading…
Reference in New Issue