diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2019-01-02 18:10:40 -0800 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2019-10-22 09:57:38 +0200 |
commit | 33ce336b82f257689e7d20cee228fa61e079b90a (patch) | |
tree | 22fb309c87c76782d97f99ffc8c33b61ef2a38df /test/example.c | |
parent | cf5959e11915d88e1b142fef3de359a1d443bd6d (diff) |
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/example.c')
-rw-r--r-- | test/example.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/test/example.c b/test/example.c index cb9e87a..8309178 100644 --- a/test/example.c +++ b/test/example.c @@ -451,9 +451,8 @@ void test_sync(unsigned char *compr, size_t comprLen, unsigned char *uncompr, si CHECK_ERR(err, "inflateSync"); err = PREFIX(inflate)(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ + if (err != Z_STREAM_END) { + fprintf(stderr, "inflate should report Z_STREAM_END\n"); exit(1); } err = PREFIX(inflateEnd)(&d_stream); |