|
|
3d619b |
From 5eaae2af0defeca148c2a281873bb31a15246876 Mon Sep 17 00:00:00 2001
|
|
|
3d619b |
From: Ilya Leoshkevich <iii@linux.ibm.com>
|
|
|
3d619b |
Date: Thu, 2 Feb 2023 19:34:24 +0100
|
|
|
3d619b |
Subject: [PATCH] 2155328
|
|
|
3d619b |
|
|
|
3d619b |
---
|
|
|
3d619b |
contrib/s390/dfltcc.c | 21 +++++++++++++++------
|
|
|
3d619b |
1 file changed, 15 insertions(+), 6 deletions(-)
|
|
|
3d619b |
|
|
|
3d619b |
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
|
|
|
3d619b |
index 72099e7..f8dc21c 100644
|
|
|
3d619b |
--- a/contrib/s390/dfltcc.c
|
|
|
3d619b |
+++ b/contrib/s390/dfltcc.c
|
|
|
3d619b |
@@ -456,7 +456,10 @@ again:
|
|
|
3d619b |
*strm->next_out = (Bytef)state->bi_buf;
|
|
|
3d619b |
/* Honor history and check value */
|
|
|
3d619b |
param->nt = 0;
|
|
|
3d619b |
- param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler;
|
|
|
3d619b |
+ if (state->wrap == 1)
|
|
|
3d619b |
+ param->cv = strm->adler;
|
|
|
3d619b |
+ else if (state->wrap == 2)
|
|
|
3d619b |
+ param->cv = ZSWAP32(strm->adler);
|
|
|
3d619b |
|
|
|
3d619b |
/* When opening a block, choose a Huffman-Table Type */
|
|
|
3d619b |
if (!param->bcf) {
|
|
|
3d619b |
@@ -488,7 +491,10 @@ again:
|
|
|
3d619b |
state->bi_buf = 0; /* Avoid accessing next_out */
|
|
|
3d619b |
else
|
|
|
3d619b |
state->bi_buf = *strm->next_out & ((1 << state->bi_valid) - 1);
|
|
|
3d619b |
- strm->adler = state->wrap == 2 ? ZSWAP32(param->cv) : param->cv;
|
|
|
3d619b |
+ if (state->wrap == 1)
|
|
|
3d619b |
+ strm->adler = param->cv;
|
|
|
3d619b |
+ else if (state->wrap == 2)
|
|
|
3d619b |
+ strm->adler = ZSWAP32(param->cv);
|
|
|
3d619b |
|
|
|
3d619b |
/* Unmask the input data */
|
|
|
3d619b |
strm->avail_in += masked_avail_in;
|
|
|
3d619b |
@@ -600,11 +606,12 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
|
|
3d619b |
}
|
|
|
3d619b |
|
|
|
3d619b |
/* Translate stream to parameter block */
|
|
|
3d619b |
- param->cvt = state->flags ? CVT_CRC32 : CVT_ADLER32;
|
|
|
3d619b |
+ param->cvt = ((state->wrap & 4) && state->flags) ? CVT_CRC32 : CVT_ADLER32;
|
|
|
3d619b |
param->sbb = state->bits;
|
|
|
3d619b |
if (param->hl)
|
|
|
3d619b |
param->nt = 0; /* Honor history for the first block */
|
|
|
3d619b |
- param->cv = state->flags ? ZSWAP32(state->check) : state->check;
|
|
|
3d619b |
+ if (state->wrap & 4)
|
|
|
3d619b |
+ param->cv = state->flags ? ZSWAP32(state->check) : state->check;
|
|
|
3d619b |
|
|
|
3d619b |
/* Inflate */
|
|
|
3d619b |
do {
|
|
|
3d619b |
@@ -615,7 +622,9 @@ dfltcc_inflate_action ZLIB_INTERNAL dfltcc_inflate(strm, flush, ret)
|
|
|
3d619b |
strm->msg = oesc_msg(dfltcc_state->msg, param->oesc);
|
|
|
3d619b |
state->last = cc == DFLTCC_CC_OK;
|
|
|
3d619b |
state->bits = param->sbb;
|
|
|
3d619b |
- strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv;
|
|
|
3d619b |
+ if (state->wrap & 4)
|
|
|
3d619b |
+ strm->adler = state->check = state->flags ?
|
|
|
3d619b |
+ ZSWAP32(param->cv) : param->cv;
|
|
|
3d619b |
if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) {
|
|
|
3d619b |
/* Report an error if stream is corrupted */
|
|
|
3d619b |
state->mode = BAD;
|
|
|
3d619b |
@@ -1077,4 +1086,4 @@ int ZLIB_INTERNAL dfltcc_inflate_get_dictionary(strm, dictionary, dict_length)
|
|
|
3d619b |
if (dict_length)
|
|
|
3d619b |
*dict_length = param->hl;
|
|
|
3d619b |
return Z_OK;
|
|
|
3d619b |
-}
|
|
|
3d619b |
\ No newline at end of file
|
|
|
3d619b |
+}
|
|
|
3d619b |
--
|
|
|
3d619b |
2.39.1
|
|
|
3d619b |
|