From: Ilya Leoshkevich Date: Sat, 17 Sep 2022 13:32:29 +0000 (+0200) Subject: IBM Z DFLTCC: Fix updating strm.adler with inflate() X-Git-Tag: 2.1.0-beta1~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d38dd9240f2de436769c9ce9549e15cb0d0cfd32;p=thirdparty%2Fzlib-ng.git IBM Z DFLTCC: Fix updating strm.adler with inflate() inflate() does not update strm.adler with DFLTCC. Add a missing assignment to dfltcc_inflate() to fix this. Note that deflate() is not affected. Also add a test to prevent regressions. --- diff --git a/arch/s390/dfltcc_inflate.c b/arch/s390/dfltcc_inflate.c index 7a422d97e..b7ecbe275 100644 --- a/arch/s390/dfltcc_inflate.c +++ b/arch/s390/dfltcc_inflate.c @@ -115,7 +115,7 @@ dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, i state->bits = param->sbb; state->whave = param->hl; state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1); - state->check = state->flags ? ZSWAP32(param->cv) : param->cv; + strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv; if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { /* Report an error if stream is corrupted */ state->mode = BAD; diff --git a/test/test_inflate_adler32.cc b/test/test_inflate_adler32.cc index e17cf6b79..fb78bb1bf 100644 --- a/test/test_inflate_adler32.cc +++ b/test/test_inflate_adler32.cc @@ -41,6 +41,8 @@ TEST(inflate, adler32) { err = PREFIX(inflate)(&strm, Z_NO_FLUSH); EXPECT_EQ(err, Z_STREAM_END); + EXPECT_EQ(strm.adler, 0x6b931030); + err = PREFIX(inflateEnd)(&strm); EXPECT_EQ(err, Z_OK);