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