]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed zstreamtest
authorYann Collet <cyan@fb.com>
Wed, 28 Jun 2017 16:57:59 +0000 (09:57 -0700)
committerYann Collet <cyan@fb.com>
Wed, 28 Jun 2017 16:57:59 +0000 (09:57 -0700)
modifying compression parameters is not allowed after ZSTD_CCtx_loadDictionary()
but it is still allowed after ZSTD_refPrefix()

tests/zstreamtest.c

index f6bb440ce308e87c7ddbc266e8f6b0df91fbda7c..4c44795570d3594546c3b9d13fd43eae9cce59fb 100644 (file)
@@ -1311,13 +1311,14 @@ static int fuzzerTests_newAPI(U32 seed, U32 nbTests, unsigned startTest, double
 
                 /* unconditionally set, to be sync with decoder */
                 if (FUZ_rand(&lseed) & 1) CHECK_Z( ZSTD_CCtx_setParameter(zc, ZSTD_p_refDictContent, FUZ_rand(&lseed) & 1) );
-                if (FUZ_rand(&lseed) & 1) { CHECK_Z( ZSTD_CCtx_loadDictionary(zc, dict, dictSize) ); }
-                else { CHECK_Z( ZSTD_CCtx_refPrefix(zc, dict, dictSize) ); }
-
-                if (dict && dictSize) {
-                    /* test that compression parameters are correctly rejected after setting a dictionary */
-                    size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_p_windowLog, cParams.windowLog-1) ;
-                    CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
+                if (FUZ_rand(&lseed) & 1) {
+                    CHECK_Z( ZSTD_CCtx_loadDictionary(zc, dict, dictSize) );
+                    if (dict && dictSize) {
+                        /* test that compression parameters are rejected (correctly) after loading a non-NULL dictionary */
+                        size_t const setError = ZSTD_CCtx_setParameter(zc, ZSTD_p_windowLog, cParams.windowLog-1) ;
+                        CHECK(!ZSTD_isError(setError), "ZSTD_CCtx_setParameter should have failed");
+                }   } else {
+                    CHECK_Z( ZSTD_CCtx_refPrefix(zc, dict, dictSize) );
                 }
 
                 /* mess with frame parameters */