fuzz: make target resist allocation failures (#1023)

So that fuzzing can go on with simulated allocation failures
This commit is contained in:
Catena cyber 2023-06-22 10:27:21 +02:00 committed by GitHub
parent 1d8452b783
commit bfa15d4046
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,11 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size_t total_out = 0;
BrotliDecoderState* state = BrotliDecoderCreateInstance(0, 0, 0);
if (!state) {
// OOM is out-of-scope here.
free(buffer);
return 0;
}
if (addend == 0)
addend = size;