Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzip was not building with bzip2 support #18

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions build/unzip/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ HARDLINK_TARGETS="
"
SKIP_LICENCES="*"

# Copied from upstream's pkg makefile
export LOCAL_UNZIP="-DUNICODE_SUPPORT -DNO_WORKING_ISPRINT -DUNICODE_WCHAR"
CONFIGURE_OPTS="
-DWILD_STOP_AT_DIR
"
export LOCAL_UNZIP="${CONFIGURE_OPTS[0]//$'\n'/}"

configure_amd64() {
export i386
Expand All @@ -48,6 +50,7 @@ configure_aarch64() {
}

pre_install() {
ldd $PROG | $EGREP -s libbz2 || logerr "unzip was built without bzip2"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should be using eldfump -d here as otherwise you could get a false positive if a dep of a dep had libbz2 support.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, and the test also doesn't work for cross compiled binaries such as aarch64. Here's an update.

save_variable MAKE_INSTALL_ARGS
MAKE_INSTALL_ARGS+=" prefix=$DESTDIR$PREFIX"
}
Expand All @@ -58,7 +61,7 @@ post_install() {


BASE_MAKE_ARGS="-f unix/Makefile"
MAKE_ARGS="$BASE_MAKE_ARGS generic IZ_BZIP2=bzip2"
MAKE_ARGS="$BASE_MAKE_ARGS generic"
MAKE_INSTALL_ARGS="$BASE_MAKE_ARGS install"

init
Expand Down
2 changes: 1 addition & 1 deletion build/unzip/patches/CVE-2014-8139-crc-overflow.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff -wpruN '--exclude=*.orig' a~/extract.c a/extract.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/extract.c a/extract.c
--- a~/extract.c 1970-01-01 00:00:00
+++ a/extract.c 1970-01-01 00:00:00
@@ -1,5 +1,5 @@
Expand Down
2 changes: 1 addition & 1 deletion build/unzip/patches/CVE-2014-8140-test-compr-eb.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff -wpruN '--exclude=*.orig' a~/extract.c a/extract.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/extract.c a/extract.c
--- a~/extract.c 1970-01-01 00:00:00
+++ a/extract.c 1970-01-01 00:00:00
@@ -2232,10 +2232,17 @@ static int test_compr_eb(__G__ eb, eb_si
Expand Down
4 changes: 2 additions & 2 deletions build/unzip/patches/CVE-2014-8141-getzip64data.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff -wpruN '--exclude=*.orig' a~/fileio.c a/fileio.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/fileio.c a/fileio.c
--- a~/fileio.c 1970-01-01 00:00:00
+++ a/fileio.c 1970-01-01 00:00:00
@@ -176,6 +176,8 @@ static ZCONST char Far FilenameTooLongTr
Expand All @@ -24,7 +24,7 @@ diff -wpruN '--exclude=*.orig' a~/fileio.c a/fileio.c
#ifdef UNICODE_SUPPORT
G.unipath_filename = NULL;
if (G.UzO.U_flag < 2) {
diff -wpruN '--exclude=*.orig' a~/process.c a/process.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/process.c a/process.c
--- a~/process.c 1970-01-01 00:00:00
+++ a/process.c 1970-01-01 00:00:00
@@ -1,5 +1,5 @@
Expand Down
2 changes: 1 addition & 1 deletion build/unzip/patches/CVE-2014-9636-test-compr-eb.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff -wpruN '--exclude=*.orig' a~/extract.c a/extract.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/extract.c a/extract.c
--- a~/extract.c 1970-01-01 00:00:00
+++ a/extract.c 1970-01-01 00:00:00
@@ -2228,6 +2228,7 @@ static int test_compr_eb(__G__ eb, eb_si
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bug-Debian: https://bugs.debian.org/847485
Bug-Ubuntu: https://launchpad.net/bugs/387350
X-Debian-version: 6.0-21

diff -wpruN '--exclude=*.orig' a~/list.c a/list.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/list.c a/list.c
--- a~/list.c 1970-01-01 00:00:00
+++ a/list.c 1970-01-01 00:00:00
@@ -339,7 +339,18 @@ int list_files(__G) /* return PK-type
Expand Down
2 changes: 1 addition & 1 deletion build/unzip/patches/CVE-2015-7696-heap-overflow.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bug-Debian: https://bugs.debian.org/802162
Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1260944
Origin: https://bugzilla.redhat.com/attachment.cgi?id=1073002

diff -wpruN '--exclude=*.orig' a~/crypt.c a/crypt.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/crypt.c a/crypt.c
--- a~/crypt.c 1970-01-01 00:00:00
+++ a/crypt.c 1970-01-01 00:00:00
@@ -465,7 +465,17 @@ int decrypt(__G__ passwrd)
Expand Down
2 changes: 1 addition & 1 deletion build/unzip/patches/CVE-2015-7697-infinite-loop.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bug-Debian: https://bugs.debian.org/802160
Bug-RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=1260944
Origin: other, https://bugzilla.redhat.com/attachment.cgi?id=1073339

diff -wpruN '--exclude=*.orig' a~/extract.c a/extract.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/extract.c a/extract.c
--- a~/extract.c 1970-01-01 00:00:00
+++ a/extract.c 1970-01-01 00:00:00
@@ -2728,6 +2728,12 @@ __GDEF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bug-Debian: https://bugs.debian.org/847486
Bug-Ubuntu: https://launchpad.net/bugs/1643750
X-Debian-version: 6.0-21

diff -wpruN '--exclude=*.orig' a~/zipinfo.c a/zipinfo.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/zipinfo.c a/zipinfo.c
--- a~/zipinfo.c 1970-01-01 00:00:00
+++ a/zipinfo.c 1970-01-01 00:00:00
@@ -1921,7 +1921,18 @@ static int zi_short(__G) /* return PK-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
diff -wpruN '--exclude=*.orig' a~/fileio.c a/fileio.c
diff -wpruN --no-dereference '--exclude=*.orig' a~/fileio.c a/fileio.c
--- a~/fileio.c 1970-01-01 00:00:00
+++ a/fileio.c 1970-01-01 00:00:00
@@ -1,5 +1,5 @@
Expand Down
23 changes: 23 additions & 0 deletions build/unzip/patches/CVE-2019-13232a.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From: Mark Adler <[email protected]>
Subject: Fix bug in undefer_input() that misplaced the input state.
Origin: https://github.com/madler/unzip/commit/41beb477c5744bc396fa1162ee0c14218ec12213
Bug-Debian: https://bugs.debian.org/931433
X-Debian-version: 6.0-24

Fix bug in undefer_input() that misplaced the input state.

diff -wpruN --no-dereference '--exclude=*.orig' a~/fileio.c a/fileio.c
--- a~/fileio.c 1970-01-01 00:00:00
+++ a/fileio.c 1970-01-01 00:00:00
@@ -532,8 +532,10 @@ void undefer_input(__G)
* This condition was checked when G.incnt_leftover was set > 0 in
* defer_leftover_input(), and it is NOT allowed to touch G.csize
* before calling undefer_input() when (G.incnt_leftover > 0)
- * (single exception: see read_byte()'s "G.csize <= 0" handling) !!
+ * (single exception: see readbyte()'s "G.csize <= 0" handling) !!
*/
+ if (G.csize < 0L)
+ G.csize = 0L;
G.incnt = G.incnt_leftover + (int)G.csize;
G.inptr = G.inptr_leftover - (int)G.csize;
G.incnt_leftover = 0;
Loading