Compare commits

..

No commits in common. "c8" and "c9-beta" have entirely different histories.
c8 ... c9-beta

10 changed files with 93 additions and 131 deletions

View File

@ -1 +1 @@
3f89f861209ce81a6bab1fd1998c0ef311712002 SOURCES/bzip2-1.0.6.tar.gz
bf7badf7e248e0ecf465d33c2f5aeec774209227 SOURCES/bzip2-1.0.8.tar.gz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/bzip2-1.0.6.tar.gz
SOURCES/bzip2-1.0.8.tar.gz

View File

@ -1,12 +0,0 @@
--- bzip2-1.0.4/bzip2recover.c.pom 2007-01-03 03:00:55.000000000 +0100
+++ bzip2-1.0.4/bzip2recover.c 2007-02-05 11:55:17.000000000 +0100
@@ -309,7 +309,8 @@
UInt32 buffHi, buffLo, blockCRC;
Char* p;
- strcpy ( progName, argv[0] );
+ strncpy ( progName, argv[0], BZ_MAX_FILENAME-1);
+ progName[BZ_MAX_FILENAME-1]='\0';
inFileName[0] = outFileName[0] = 0;
fprintf ( stderr,

View File

@ -5,8 +5,8 @@ diff -up bzip2-1.0.6/Makefile-libbz2_so.pom bzip2-1.0.6/Makefile-libbz2_so
bzlib.o
all: $(OBJS)
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 $(OBJS)
+ $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 $(OBJS)
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS)
+ $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS)
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.6 libbz2.so.1.0
ln -s libbz2.so.1.0.8 libbz2.so.1.0

View File

@ -27,10 +27,10 @@ diff -up bzip2-1.0.6/Makefile-libbz2_so.jx bzip2-1.0.6/Makefile-libbz2_so
bzlib.o
all: $(OBJS)
- $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 $(OBJS)
- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6
- $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS)
- $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.6 libbz2.so.1.0
ln -s libbz2.so.1.0.8 libbz2.so.1.0

View File

@ -5,8 +5,8 @@ diff -up bzip2-1.0.6/Makefile-libbz2_so.pom bzip2-1.0.6/Makefile-libbz2_so
bzlib.o
all: $(OBJS)
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
+ $(CC) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.6 $(OBJS)
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.6
- $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.8 $(OBJS)
+ $(CC) -shared -Wl,-soname -Wl,libbz2.so.1 -o libbz2.so.1.0.8 $(OBJS)
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8
rm -f libbz2.so.1.0
ln -s libbz2.so.1.0.6 libbz2.so.1.0
ln -s libbz2.so.1.0.8 libbz2.so.1.0

View File

@ -1,61 +0,0 @@
From b07b105d1b66e32760095e3602261738443b9e13 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 3 Jul 2019 01:28:11 +0200
Subject: Accept as many selectors as the file format allows.
But ignore any larger than the theoretical maximum, BZ_MAX_SELECTORS.
The theoretical maximum number of selectors depends on the maximum
blocksize (900000 bytes) and the number of symbols (50) that can be
encoded with a different Huffman tree. BZ_MAX_SELECTORS is 18002.
But the bzip2 file format allows the number of selectors to be encoded
with 15 bits (because 18002 isn't a factor of 2 and doesn't fit in
14 bits). So the file format maximum is 32767 selectors.
Some bzip2 encoders might actually have written out more selectors
than the theoretical maximum because they rounded up the number of
selectors to some convenient factor of 8.
The extra 14766 selectors can never be validly used by the decompression
algorithm. So we can read them, but then discard them.
This is effectively what was done (by accident) before we added a
check for nSelectors to be at most BZ_MAX_SELECTORS to mitigate
CVE-2019-12900.
The extra selectors were written out after the array inside the
EState struct. But the struct has extra space allocated after the
selector arrays of 18060 bytes (which is larger than 14766).
All of which will be initialized later (so the overwrite of that
space with extra selector values would have been harmless).
Note by jamartis:
The original patch Described above also reverts some changes that were made after 1.0.6.
Since these changes are not yet present in 1.0.6, they don't need to be reverted and are thus
removed from the original patch
---
diff --git a/decompress.c b/decompress.c
index 20ce493..3303499 100644
--- a/decompress.c
+++ b/decompress.c
@@ -296,8 +296,14 @@ Int32 BZ2_decompress ( DState* s )
j++;
if (j >= nGroups) RETURN(BZ_DATA_ERROR);
}
- s->selectorMtf[i] = j;
+ /* Having more than BZ_MAX_SELECTORS doesn't make much sense
+ since they will never be used, but some implementations might
+ "round up" the number of selectors, so just ignore those. */
+ if (i < BZ_MAX_SELECTORS)
+ s->selectorMtf[i] = j;
}
+ if (nSelectors > BZ_MAX_SELECTORS)
+ nSelectors = BZ_MAX_SELECTORS;
/*--- Undo the MTF values for the selectors. ---*/
{
--
cgit

View File

@ -0,0 +1,20 @@
--- ./bzip2-1.0.8/bzip2.1 2019-07-13 19:50:05.000000000 +0200
+++ ./bzip2-1.0.8/bzip2.1.new 2021-01-29 11:51:04.091430407 +0100
@@ -170,6 +170,17 @@
to try to recover data from
damaged files.
+Unlike
+.I GNU gzip,
+.I bzip2
+will not create a cascade of
+.I .bz2
+suffixes even when using the
+.I --force
+option:
+
+ filename.bz2 dose not become filename.bz2.bz2
+
Return values: 0 for a normal exit, 1 for environmental problems (file
not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
compressed file, 3 for an internal consistency error (eg, bug) which

View File

@ -1,11 +0,0 @@
diff -up ./bzip2recover.c.old ./bzip2recover.c
--- ./bzip2recover.c.old 2016-03-22 08:49:38.855620000 +0100
+++ ./bzip2recover.c 2016-03-30 10:22:27.341430099 +0200
@@ -458,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv )
bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
bsPutUInt32 ( bsWr, blockCRC );
bsClose ( bsWr );
+ outFile = NULL;
}
if (wrBlock >= rbCtr) break;
wrBlock++;

View File

@ -1,23 +1,22 @@
%global library_version 1.0.6
%global library_version 1.0.8
Summary: A file compression utility
Name: bzip2
Version: 1.0.6
Release: 28%{?dist}
Version: 1.0.8
Release: 8%{?dist}
License: BSD
Group: Applications/File
URL: http://www.bzip.org/
Source0: http://www.bzip.org/%{version}/%{name}-%{version}.tar.gz
#Source0: http://www.bzip.org/%{version}/%{name}-%{version}.tar.gz
Source0: https://sourceware.org/pub/bzip2/%{name}-%{version}.tar.gz
Source1: bzip2.pc
Patch0: bzip2-1.0.4-saneso.patch
Patch1: bzip2-1.0.4-cflags.patch
# resolves: #226979
Patch2: bzip2-1.0.4-bzip2recover.patch
Patch3: bzip2-ldflags.patch
# resolves: #1348179
Patch4: set-out-file-to-null.patch
Patch5: decompress-out-of-bounds.patch
Patch0: bzip2-saneso.patch
Patch1: bzip2-cflags.patch
Patch2: bzip2-ldflags.patch
Patch3: man_gzipdiff.patch
BuildRequires: gcc
BuildRequires: make
%description
Bzip2 is a freely available, patent-free, high quality data compressor.
@ -32,7 +31,6 @@ Install bzip2 if you need a compression utility.
%package devel
Summary: Libraries and header files for apps which will use bzip2
Group: Development/Libraries
Requires: bzip2-libs = %{version}-%{release}
%description devel
@ -42,7 +40,6 @@ which will use the library.
%package libs
Summary: Libraries for applications using bzip2
Group: System Environment/Libraries
%description libs
@ -50,7 +47,6 @@ Libraries for applications using the bzip2 compression format.
%package static
Summary: Libraries for applications using bzip2
Group: System Environment/Libraries
%description static
@ -58,12 +54,10 @@ Static libraries for applications using the bzip2 compression format.
%prep
%setup -q
%patch0 -p1 -b .saneso
%patch1 -p1 -b .cflags
%patch2 -p1 -b .bz2recover
%patch3 -p1 -b .ldflags
%patch4 -p1 -b .bzip2recover
%patch5 -p1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p2
cp -a %{SOURCE1} .
sed -i "s|^libdir=|libdir=%{_libdir}|" bzip2.pc
@ -79,16 +73,16 @@ sed -i "s|^libdir=|libdir=%{_libdir}|" bzip2.pc
export O3=""
%endif
make -f Makefile-libbz2_so CC="%{__cc}" AR="%{__ar}" RANLIB="%{__ranlib}" \
%make_build -f Makefile-libbz2_so CC="%{__cc}" AR="%{__ar}" RANLIB="%{__ranlib}" \
CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -fpic -fPIC $O3" \
LDFLAGS="%{__global_ldflags}" \
%{?_smp_mflags} all
all
rm -f *.o
make CC="%{__cc}" AR="%{__ar}" RANLIB="%{__ranlib}" \
%make_build CC="%{__cc}" AR="%{__ar}" RANLIB="%{__ranlib}" \
CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 $O3" \
LDFLAGS="%{__global_ldflags}" \
%{?_smp_mflags} all
all
%install
chmod 644 bzlib.h
@ -142,13 +136,45 @@ ln -s bzgrep.1 $RPM_BUILD_ROOT%{_mandir}/man1/bzfgrep.1
%{_libdir}/pkgconfig/bzip2.pc
%changelog
* Thu Dec 19 2024 Jakub Martisko <jamartis@redhat.com> - 1.0.6-28
- The previous fix caused some regressions
- Use an updated patch that deals with the original issue+the regressions
Resolves: RHEL-71140
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.8-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Oct 29 2024 Jacek Migacz <jmigacz@redhat.com> - 1.0.6-27
- Fixes out of bounds access in BZ2_decompress (RHEL-64929)
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1.0.8-7
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Fri Jan 29 2021 Jakub Martisko <jamartis@redhat.com> - 1.0.8-6
- Minor man pgae update (gzip/bzip2 differnces)
resolves: #1897104
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Jakub Martisko <jamartis@redhat.com> - 1.0.8-4
- Use make macros
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Aug 06 2019 Jakub Martisko <jamartis@redhat.com> - 1.0.8-1
- Update to version 1.0.8
resolves: #1724797
resolves: #1717478
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Mar 01 2018 Jakub Martisko <jamartis@redhat.com> - 1.0.6-27
- Add gcc to buildrequires
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild