]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[fuzz] Increase output buffer size of stream_round_trip 1832/head
authorNick Terrell <nickrterrell@gmail.com>
Fri, 18 Oct 2019 20:34:35 +0000 (13:34 -0700)
committerNick Terrell <nickrterrell@gmail.com>
Fri, 18 Oct 2019 20:39:08 +0000 (13:39 -0700)
Fixes OSS-Fuzz crash.
Credit to OSS-Fuzz

tests/fuzz/stream_round_trip.c

index c534a904a1c7c33e6929d5c72a0a557d1d9baaf2..703b11713364baf036b4daff48e9a8285daf21fe 100644 (file)
@@ -125,13 +125,14 @@ static size_t compress(uint8_t *dst, size_t capacity,
 
 int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
 {
+    size_t neededBufSize;
+
     /* Give a random portion of src data to the producer, to use for
     parameter generation. The rest will be used for (de)compression */
     FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size);
     size = FUZZ_dataProducer_reserveDataPrefix(producer);
 
-    size_t neededBufSize;
-    neededBufSize = ZSTD_compressBound(size) * 5;
+    neededBufSize = ZSTD_compressBound(size) * 15;
 
     /* Allocate all buffers and contexts if not already allocated */
     if (neededBufSize > bufSize) {