aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2019-01-02 18:10:40 -0800
committerMark Adler <madler@alumni.caltech.edu>2019-01-02 20:40:40 -0800
commit0d36ec47f310478549c0864f215ab5c0114c49ba (patch)
tree19821ce1a005e7a5741b65e27ef6a83d8a7a565f /test
parent7c0c75e990ca5395139c148f120042048b0ce091 (diff)
downloadzlib-0d36ec47f310478549c0864f215ab5c0114c49ba.tar.gz
zlib-0d36ec47f310478549c0864f215ab5c0114c49ba.tar.bz2
zlib-0d36ec47f310478549c0864f215ab5c0114c49ba.zip
Don't bother computing check value after successful inflateSync().
inflateSync() is used to skip invalid deflate data, which means that the check value that was being computed is no longer useful. This commit turns off the check value computation, and furthermore allows a successful return if the compressed data terminated in a graceful manner. This commit also fixes a bug in the case that inflateSync() is used before a header is ever processed. In that case, there is no knowledge of a trailer, so the remainder is treated as raw.
Diffstat (limited to 'test')
-rw-r--r--test/example.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/example.c b/test/example.c
index eee17ce..949f4f6 100644
--- a/test/example.c
+++ b/test/example.c
@@ -440,9 +440,8 @@ void test_sync(compr, comprLen, uncompr, uncomprLen)
440 CHECK_ERR(err, "inflateSync"); 440 CHECK_ERR(err, "inflateSync");
441 441
442 err = inflate(&d_stream, Z_FINISH); 442 err = inflate(&d_stream, Z_FINISH);
443 if (err != Z_DATA_ERROR) { 443 if (err != Z_STREAM_END) {
444 fprintf(stderr, "inflate should report DATA_ERROR\n"); 444 fprintf(stderr, "inflate should report Z_STREAM_END\n");
445 /* Because of incorrect adler32 */
446 exit(1); 445 exit(1);
447 } 446 }
448 err = inflateEnd(&d_stream); 447 err = inflateEnd(&d_stream);