aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatena cyber <35799796+catenacyber@users.noreply.github.com>2023-06-22 10:27:21 +0200
committerGitHub <noreply@github.com>2023-06-22 10:27:21 +0200
commitbfa15d4046173e47553af692e20e145a95c36084 (patch)
treec5a548e3cde245d768dae41a7fbe328db1e1cc2c
parent1d8452b783dafd7e2acc0914919d38d46b861765 (diff)
downloadbrotli-bfa15d4046173e47553af692e20e145a95c36084.zip
brotli-bfa15d4046173e47553af692e20e145a95c36084.tar.gz
brotli-bfa15d4046173e47553af692e20e145a95c36084.tar.bz2
fuzz: make target resist allocation failures (#1023)
So that fuzzing can go on with simulated allocation failures
-rw-r--r--c/fuzz/decode_fuzzer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/c/fuzz/decode_fuzzer.c b/c/fuzz/decode_fuzzer.c
index 46144e0..697f9bf 100644
--- a/c/fuzz/decode_fuzzer.c
+++ b/c/fuzz/decode_fuzzer.c
@@ -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;