diff --git a/backport-gzip-fix-l-bug-with-multimember-files.patch b/backport-gzip-fix-l-bug-with-multimember-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..c663b5e81b255582c0cef5aaba3a6aec9d39ec6f --- /dev/null +++ b/backport-gzip-fix-l-bug-with-multimember-files.patch @@ -0,0 +1,102 @@ +From 607bc945230c9fdcad24527578bf3605f446dc7c Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 8 Jan 2024 20:39:05 -0800 +Subject: gzip: fix -l bug with multimember files + +Problem reported by Antonio Diaz Diaz in: +https://lists.gnu.org/r/bug-gzip/2024-01/msg00000.html +* gzip.c (treat_stdin, treat_file): Do not clear bytes_out. +* tests/list: Test for the bug. +* unpack.c (unpack): +* unzip.c (unzip): +Do not assume bytes_out is initially zero. +--- + gzip.c | 2 -- + tests/list | 9 +++++++++ + unpack.c | 3 ++- + unzip.c | 3 ++- + 4 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/gzip.c b/gzip.c +index 35cb662..b61887d 100644 +--- a/gzip.c ++++ b/gzip.c +@@ -788,7 +788,6 @@ treat_stdin () + + method = get_method(ifd); + if (method < 0) return; /* error message already emitted */ +- bytes_out = 0; /* required for length check */ + } + + if (list) +@@ -995,7 +994,6 @@ treat_file (char *iname) + + method = get_method(ifd); + if (method < 0) break; /* error message already emitted */ +- bytes_out = 0; /* required for length check */ + } + + if (close (ifd) != 0) +diff --git a/tests/list b/tests/list +index 85478d2..98057bb 100755 +--- a/tests/list ++++ b/tests/list +@@ -28,4 +28,13 @@ gzip -l in.gz >out1 || fail=1 + gzip -l in.gz | cat >out2 || fail=1 + compare out1 out2 || fail=1 + ++echo '' >small || framework_failure_ ++gzip small || fail=1 ++cat small.gz small.gz >smallx2.gz || framework_failure_ ++gzip -l smallx2.gz >smallout || fail=1 ++case $(cat smallout) in ++ *' 2 '*' smallx2') ;; ++ *) cat smallout; fail=1;; ++esac ++ + Exit $fail +diff --git a/unpack.c b/unpack.c +index d192067..9b178ba 100644 +--- a/unpack.c ++++ b/unpack.c +@@ -221,6 +221,7 @@ unpack (int in, int out) + unsigned eob; /* End Of Block code */ + register unsigned peek; /* lookahead bits */ + unsigned peek_mask; /* Mask for peek_bits bits */ ++ off_t orig_bytes_out = bytes_out; + + ifd = in; + ofd = out; +@@ -266,7 +267,7 @@ unpack (int in, int out) + } /* for (;;) */ + + flush_window(); +- if (orig_len != (ulg)(bytes_out & 0xffffffff)) { ++ if (orig_len != (ulg)((bytes_out - orig_bytes_out) & 0xffffffff)) { + gzip_error ("invalid compressed data--length error"); + } + return OK; +diff --git a/unzip.c b/unzip.c +index 9b22101..07c9027 100644 +--- a/unzip.c ++++ b/unzip.c +@@ -117,6 +117,7 @@ unzip (int in, int out) + { + ulg orig_crc = 0; /* original crc */ + ulg orig_len = 0; /* original uncompressed length */ ++ off_t orig_bytes_out = bytes_out; + int n; + uch buf[EXTHDR]; /* extended local header */ + int err = OK; +@@ -194,7 +195,7 @@ unzip (int in, int out) + program_name, ifname); + err = ERROR; + } +- if (orig_len != (ulg)(bytes_out & 0xffffffff)) { ++ if (orig_len != (ulg)((bytes_out - orig_bytes_out) & 0xffffffff)) { + fprintf(stderr, "\n%s: %s: invalid compressed data--length error\n", + program_name, ifname); + err = ERROR; +-- +cgit v1.2.3 + diff --git a/gzip.spec b/gzip.spec index eb4373f3e538d3748fab574f440938964cf82114..3384000fb3ccd3eb76fbba788c3a1c417dfc0056 100644 --- a/gzip.spec +++ b/gzip.spec @@ -1,6 +1,6 @@ Name: gzip Version: 1.12 -Release: 1 +Release: 2 Summary: A data compression utility License: GPLv3 @@ -11,6 +11,7 @@ Source2: colorzgrep.sh Patch6000: backport-gzip-test-invalid-input-bug.patch Patch6001: backport-gzip-detect-invalid-input.patch +Patch6002: backport-gzip-fix-l-bug-with-multimember-files.patch Patch9000: fix-verbose-disable.patch Patch9001: performance-neoncrc32-and-prfm.patch @@ -70,6 +71,9 @@ make check %{_mandir}/man1/* %changelog +* Tue Sep 09 2025 yanglongkang - 1.12-2 +- fix -l bug with multimember files + * Tue Oct 24 2023 yixiangzhike - 1.12-1 - update to 1.12