Skip to content

Commit

Permalink
IBM Z DFLTCC: Fix updating strm.adler with inflate()
Browse files Browse the repository at this point in the history
inflate() does not update strm.adler with DFLTCC, as reported in [1].
Add a missing assignment to dfltcc_inflate() to fix this.
Note that deflate() is not affected.

Also add a test to prevent regressions.

[1] https://github.ibm.com/runtimes/openj9-jit-z/issues/728
  • Loading branch information
iii-i authored and mephi42 committed Sep 17, 2022
1 parent 8353094 commit bd2193d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/dfltcc_inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions test/test_inflate_adler32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit bd2193d

Please sign in to comment.