diff options
author | bimbashrestha <bshrestha.msae@gmail.com> | 2019-08-16 21:19:06 (GMT) |
---|---|---|
committer | bimbashrestha <bshrestha.msae@gmail.com> | 2019-08-16 21:19:06 (GMT) |
commit | a9ac05645644a0615b558f6ac655c4ae46c4a926 (patch) | |
tree | 4edf495099dc938d8b29d5f2bc299fcac524532b /ossfuzz/decompress_fuzzer.c | |
parent | fad8c97532f74d92f6aa4427a739610035fcbbd1 (diff) | |
download | lz4-a9ac05645644a0615b558f6ac655c4ae46c4a926.zip lz4-a9ac05645644a0615b558f6ac655c4ae46c4a926.tar.gz lz4-a9ac05645644a0615b558f6ac655c4ae46c4a926.tar.bz2 |
Created a data producer API and used in decompress_fuzzer
Diffstat (limited to 'ossfuzz/decompress_fuzzer.c')
-rw-r--r-- | ossfuzz/decompress_fuzzer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ossfuzz/decompress_fuzzer.c b/ossfuzz/decompress_fuzzer.c index b17783c..49f71b0 100644 --- a/ossfuzz/decompress_fuzzer.c +++ b/ossfuzz/decompress_fuzzer.c @@ -14,7 +14,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - size_t const dstCapacity = FUZZ_produceUint32Range(data, size, 0, 4 * size); + FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size); + size_t const dstCapacity = FUZZ_dataProducer_uint32(producer, 0, 4 * size); size_t const smallDictSize = size + 1; size_t const largeDictSize = 64 * 1024 - 1; size_t const dictSize = MAX(smallDictSize, largeDictSize); @@ -24,6 +25,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) char* const dataAfterDict = dict + dictSize; char* const smallDict = dataAfterDict - smallDictSize; + /* Restrict to remaining data from producer */ + size = producer->size; + FUZZ_ASSERT(dst); FUZZ_ASSERT(dict); @@ -52,6 +56,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) dstCapacity, dstCapacity); free(dst); free(dict); + FUZZ_dataProducer_free(producer); return 0; } |