summaryrefslogtreecommitdiffstats
path: root/ossfuzz/decompress_fuzzer.c
diff options
context:
space:
mode:
Diffstat (limited to 'ossfuzz/decompress_fuzzer.c')
-rw-r--r--ossfuzz/decompress_fuzzer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ossfuzz/decompress_fuzzer.c b/ossfuzz/decompress_fuzzer.c
index 1fa2b1a..e6e14c4 100644
--- a/ossfuzz/decompress_fuzzer.c
+++ b/ossfuzz/decompress_fuzzer.c
@@ -7,22 +7,22 @@
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
+ // TODO: Size input buffer pseudo-randomly based on seed extracted from input
size_t const buffer_size = 10 * 1024 * 1024;
char *const dest_buffer = (char *)malloc(buffer_size);
- if (dest_buffer != NULL)
- {
- // Allocation succeeded, try decompressing the incoming data.
- int result = LZ4_decompress_safe((const char*)data,
- dest_buffer,
- size,
- buffer_size);
+ CHECK(dest_buffer != NULL);
- // Ignore the result of decompression.
- (void)result;
+ // Allocation succeeded, try decompressing the incoming data.
+ int result = LZ4_decompress_safe((const char*)data,
+ dest_buffer,
+ size,
+ buffer_size);
- free(dest_buffer);
- }
+ // Ignore the result of decompression.
+ (void)result;
+
+ free(dest_buffer);
return 0;
}