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