diff --git a/backport-fixed-nine-bits-processing-updated-reset-code-behavi.patch b/backport-fixed-nine-bits-processing-updated-reset-code-behavi.patch new file mode 100644 index 0000000000000000000000000000000000000000..0923f840bee0ff5f2c20ae06940ff8abd4c21440 --- /dev/null +++ b/backport-fixed-nine-bits-processing-updated-reset-code-behavi.patch @@ -0,0 +1,102 @@ +From 3303f310da2c59188fc93b79ed526cad75db323e Mon Sep 17 00:00:00 2001 +From: Andrew Aladjev +Date: Mon, 8 Feb 2021 08:00:36 +0300 +Subject: [PATCH] fixed nine bits processing, updated reset code behaviour + +Closes #5. + +The problem is that extcode and maxcode together with n_bits were not properly + initialized and reset. I've added code in the same style as code around. +--- + compress.c | 32 ++++++++++++++++++++++---------- + tests/runtests.sh | 5 +++++ + 2 files changed, 27 insertions(+), 10 deletions(-) + +diff --git a/compress.c b/compress.c +index 66cacf1..dc5a006 100644 +--- a/compress.c ++++ b/compress.c +@@ -402,6 +402,24 @@ union bytes + (o) += (n); \ + } + ++#define reset_n_bits_for_compressor(n_bits, stcode, free_ent, extcode, maxbits) { \ ++ n_bits = INIT_BITS; \ ++ stcode = 1; \ ++ free_ent = FIRST; \ ++ extcode = MAXCODE(n_bits); \ ++ if (n_bits < maxbits) \ ++ extcode++; \ ++} ++ ++#define reset_n_bits_for_decompressor(n_bits, bitmask, maxbits, maxcode, maxmaxcode) { \ ++ n_bits = INIT_BITS; \ ++ bitmask = (1<input.Z ++uncompress -c input.Z >input.new ++cmp $COMPRESS input.new ++ + : "### All passed!" +-- +2.43.0 + diff --git a/ncompress.spec b/ncompress.spec index a4410e2d35ebc68b47f55fdce6b0267f70f7e9cc..174d2a50bd59577bedccd2ea6613fe32c6785093 100644 --- a/ncompress.spec +++ b/ncompress.spec @@ -1,6 +1,6 @@ Name: ncompress Version: 5.0 -Release: 1 +Release: 2 Summary: A fast, simple LZW file compressor License: Public Domain URL: http://ncompress.sourceforge.net/ @@ -8,6 +8,8 @@ Source0: https://github.com/vapier/%{name}/archive/v%{version}.tar.gz#/%{ BuildRequires: git gcc glibc-devel +Patch0: backport-fixed-nine-bits-processing-updated-reset-code-behavi.patch + %description Compress is a fast, simple LZW file compressor. Compress does not have the highest compression rate, but it is one of the fastest programs to compress data. Compress @@ -39,6 +41,9 @@ ln -sf compress.1 %{buildroot}%{_mandir}/man1/uncompress.1 %{_mandir}/man1/*.gz %changelog +* Wed Jul 30 2025 lijinlin -5.0-2 +- backport patch from upstream to fix nine bits decompression failed + * Mon Jun 27 2022 dillon chen -5.0-1 - update to 5.0