unzip: upgraded package to upstream

Upgraded app-arch/unzip to version 6.0_p26.

BUG=None
TEST=CQ passes

Change-Id: Icb6c963de4991cbbf6af03122ba1b0667b542c99
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2923075
Tested-by: Mike Frysinger <vapier@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Sergey Frolov <sfrolov@google.com>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
diff --git a/app-arch/unzip/Manifest b/app-arch/unzip/Manifest
index 6b82ac8..8f65ff0 100644
--- a/app-arch/unzip/Manifest
+++ b/app-arch/unzip/Manifest
@@ -1,2 +1,2 @@
-DIST unzip60.tar.gz 1376845 SHA256 036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37 SHA512 0694e403ebc57b37218e00ec1a406cae5cc9c5b52b6798e0d4590840b6cdbf9ddc0d9471f67af783e960f8fa2e620394d51384257dca23d06bcd90224a80ce5d WHIRLPOOL eab32d6d0ab100d302b608658a3ae290d3dad4beddccebaf6cb6527102bb238f751ec6482dea68ae62474005de89f11f9e0cf1b1e12bee2ca5a2336a3c0c9808
-DIST unzip_6.0-21.debian.tar.xz 17740 SHA256 8accd9d214630a366476437a3ec1842f2e057fdce16042a7b19ee569c33490a3 SHA512 f7bce4156ac13c34da3f991df3ae88b0db99b0810c7f8904ea3ac666a4cb2788d7182056f2bbd82d7519d0e0ee31a10af47bee08f360ceb859e5fbfc6e15ef36 WHIRLPOOL ce4d74e27ff27183989c680ef022328915c8ade5c1f12b39bcc1ee905dbd2fd3974cbb22da9bed40d8dc7a59de9ba768bfc6bb61d3bdd1b6f571945d06bf19f6
+DIST unzip60.tar.gz 1376845 BLAKE2B 5016d300b4452018a391f4ebc03c6960c068df400a0407c0c60bd7bb5ec5012031f916d8b204a6149ba291c2c35beba40d9b43c76fc093026e79471329ab0e47 SHA512 0694e403ebc57b37218e00ec1a406cae5cc9c5b52b6798e0d4590840b6cdbf9ddc0d9471f67af783e960f8fa2e620394d51384257dca23d06bcd90224a80ce5d
+DIST unzip_6.0-26.debian.tar.xz 23708 BLAKE2B 7655396df2f8c4443bbd37a2fab590f1e66b3b8531871a6d95f281ac702e64a0e602f2412a58ff2addf4ce9cae8d146af650a18b02919d120c9db6c49df480b5 SHA512 9a56e400ad0984f87c7ee0548429349be549e35a3cae4c9acb88a8fb97a1d1fbd116cfa3292622ad8b2c67ffe79ae268861ddec1269993ba98f1a6a411b7611f
diff --git a/app-arch/unzip/files/unzip-6.0-fix-false-overlap-detection-on-32bit-systems.patch b/app-arch/unzip/files/unzip-6.0-fix-false-overlap-detection-on-32bit-systems.patch
new file mode 100644
index 0000000..ad6a157
--- /dev/null
+++ b/app-arch/unzip/files/unzip-6.0-fix-false-overlap-detection-on-32bit-systems.patch
@@ -0,0 +1,50 @@
+From 13f0260beae851f7d5dd96e9ef757d8d6d7daac1 Mon Sep 17 00:00:00 2001
+From: Mark Adler <madler@alumni.caltech.edu>
+Date: Sun, 9 Feb 2020 07:20:13 -0800
+Subject: [PATCH] Fix false overlapped components detection on 32-bit systems.
+
+32-bit systems with ZIP64_SUPPORT enabled could have different
+size types for zoff_t and zusz_t. That resulted in bad parameter
+passing to the bound tracking functions, itself due to the lack of
+use of C function prototypes in unzip. This commit assures that
+parameters are cast properly for those calls.
+
+This problem occurred only for ill-chosen make options, which give
+a 32-bit zoff_t. A proper build will result in a zoff_t of 64 bits,
+even on 32-bit systems.
+---
+ extract.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/extract.c b/extract.c
+index 1b73cb0..d9866f9 100644
+--- a/extract.c
++++ b/extract.c
+@@ -329,7 +329,7 @@ static ZCONST char Far OverlappedComponents[] =
+ 
+ 
+ /* A growable list of spans. */
+-typedef zoff_t bound_t;
++typedef zusz_t bound_t;
+ typedef struct {
+     bound_t beg;        /* start of the span */
+     bound_t end;        /* one past the end of the span */
+@@ -518,7 +518,8 @@ int extract_or_test_files(__G)    /* return PK-type error code */
+         return PK_MEM;
+     }
+     if ((G.extra_bytes != 0 &&
+-         cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
++         cover_add((cover_t *)G.cover,
++                   (bound_t)0, (bound_t)G.extra_bytes) != 0) ||
+         (G.ecrec.have_ecr64 &&
+          cover_add((cover_t *)G.cover, G.ecrec.ec64_start,
+                    G.ecrec.ec64_end) != 0) ||
+@@ -1216,7 +1217,7 @@ static int extract_or_test_entrylist(__G__ numchunk,
+ 
+         /* seek_zipf(__G__ pInfo->offset);  */
+         request = G.pInfo->offset + G.extra_bytes;
+-        if (cover_within((cover_t *)G.cover, request)) {
++        if (cover_within((cover_t *)G.cover, (bound_t)request)) {
+             Info(slide, 0x401, ((char *)slide,
+               LoadFarString(OverlappedComponents)));
+             return PK_BOMB;
diff --git a/app-arch/unzip/metadata.xml b/app-arch/unzip/metadata.xml
index e0009bf..a151503 100644
--- a/app-arch/unzip/metadata.xml
+++ b/app-arch/unzip/metadata.xml
@@ -9,7 +9,8 @@
 		<flag name="natspec">Use <pkg>dev-libs/libnatspec</pkg> to correctly decode non-ascii file names archived in Windows.</flag>
 	</use>
 	<upstream>
-		<remote-id type="sourceforge">infozip</remote-id>
 		<remote-id type="cpe">cpe:/a:info-zip:unzip</remote-id>
+		<remote-id type="github">madler/unzip</remote-id>
+		<remote-id type="sourceforge">infozip</remote-id>
 	</upstream>
 </pkgmetadata>
diff --git a/app-arch/unzip/unzip-6.0_p21-r2.ebuild b/app-arch/unzip/unzip-6.0_p26.ebuild
similarity index 75%
rename from app-arch/unzip/unzip-6.0_p21-r2.ebuild
rename to app-arch/unzip/unzip-6.0_p26.ebuild
index 07de804..f0daed3 100644
--- a/app-arch/unzip/unzip-6.0_p21-r2.ebuild
+++ b/app-arch/unzip/unzip-6.0_p26.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="6"
+EAPI=7
 
-inherit eutils toolchain-funcs flag-o-matic
+inherit toolchain-funcs flag-o-matic
 
 MY_PV="${PV//.}"
 MY_PV="${MY_PV%_p*}"
@@ -32,6 +32,7 @@
 
 	eapply "${FILESDIR}"/${PN}-6.0-no-exec-stack.patch
 	eapply "${FILESDIR}"/${PN}-6.0-format-security.patch
+	eapply "${FILESDIR}"/${PN}-6.0-fix-false-overlap-detection-on-32bit-systems.patch
 	use natspec && eapply "${FILESDIR}/${PN}-6.0-natspec.patch" #275244
 	sed -i -r \
 		-e '/^CFLAGS/d' \
@@ -57,14 +58,15 @@
 
 src_configure() {
 	case ${CHOST} in
-	i?86*-*linux*)       TARGET="linux_asm" ;;
-	*linux*)             TARGET="linux_noasm" ;;
-	i?86*-*bsd* | \
-	i?86*-dragonfly*)    TARGET="freebsd" ;; # mislabelled bsd with x86 asm
-	*bsd* | *dragonfly*) TARGET="bsd" ;;
-	*-darwin*)           TARGET="macosx" ;;
-	*-cygwin*)           TARGET="cygwin" ;;
-	*) die "Unknown target; please update the ebuild to handle ${CHOST}	" ;;
+		i?86*-*linux*)       TARGET="linux_asm" ;;
+		*linux*)             TARGET="linux_noasm" ;;
+		i?86*-*bsd* | \
+		i?86*-dragonfly*)    TARGET="freebsd" ;; # mislabelled bsd with x86 asm
+		*bsd* | *dragonfly*) TARGET="bsd" ;;
+		*-darwin*)           TARGET="macosx" ;;
+		*-solaris*)          TARGET="generic" ;;
+		*-cygwin*)           TARGET="generic" ;;
+		*) die "Unknown target; please update the ebuild to handle ${CHOST}	" ;;
 	esac
 
 	[[ ${CHOST} == *linux* ]] && append-cppflags -DNO_LCHMOD
@@ -75,7 +77,7 @@
 
 src_compile() {
 	ASFLAGS="${ASFLAGS} $(get_abi_var CFLAGS)" \
-	emake -f unix/Makefile ${TARGET}
+		emake -f unix/Makefile ${TARGET}
 }
 
 src_install() {