]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add unit test to validate the error case
authorshakeelrao <shakeelrao79@gmail.com>
Wed, 13 Mar 2019 08:43:40 +0000 (01:43 -0700)
committershakeelrao <shakeelrao79@gmail.com>
Wed, 13 Mar 2019 08:43:40 +0000 (01:43 -0700)
tests/fuzzer.c

index 37531379516380cfd61adbbd03a00cd8f4068879..b96fb4acd5d8cea5f1adaf3d75f4faee0b8eb901 100644 (file)
@@ -383,6 +383,13 @@ static int basicUnitTests(U32 seed, double compressibility)
     }
     DISPLAYLEVEL(3, "OK \n");
 
+    DISPLAYLEVEL(3, "test%3i : ZSTD_decompressBound test with invalid srcSize : ", testNb++);
+    {
+        unsigned long long bound = ZSTD_decompressBound(compressedBuffer, cSize - 1);
+        if (bound != ZSTD_CONTENTSIZE_ERROR) goto _output_error;
+    }
+    DISPLAYLEVEL(3, "OK \n");
+
     DISPLAYLEVEL(3, "test%3i : decompress %u bytes : ", testNb++, (unsigned)CNBuffSize);
     { size_t const r = ZSTD_decompress(decodedBuffer, CNBuffSize, compressedBuffer, cSize);
       if (r != CNBuffSize) goto _output_error; }