summaryrefslogtreecommitdiff
path: root/sys-libs/zlib
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/zlib')
-rw-r--r--sys-libs/zlib/Manifest2
-rw-r--r--sys-libs/zlib/files/zlib-1.2.12-CVE-2022-37434.patch55
-rw-r--r--sys-libs/zlib/zlib-1.2.12-r3.ebuild199
3 files changed, 256 insertions, 0 deletions
diff --git a/sys-libs/zlib/Manifest b/sys-libs/zlib/Manifest
index 5f9a1a887db2..89c5c9117fb5 100644
--- a/sys-libs/zlib/Manifest
+++ b/sys-libs/zlib/Manifest
@@ -2,6 +2,7 @@ AUX zlib-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch 3209 BLAKE2B 26e9fd2d
AUX zlib-1.2.11-fix-deflateParams-usage.patch 3017 BLAKE2B 2bb882ea0a7052d4fd10e999451f5358dd180d46098cc67289b370a7ef97a7f6b5c88eb375f6e7476ad96a18b1db34e6e545e7817327766d682d70e946ba0194 SHA512 ad962af0c723ce9dfd76e3f7b0a11f2972a7d7f997514e919010dc43c7d6538c30ed9216498c96b026f503c32a73502690426214f45d73107d377880557f6393
AUX zlib-1.2.11-minizip-drop-crypt-header.patch 997 BLAKE2B a964dfb26d05045507cb2ebf1154b890782d9952288627dd5093eeeaed9265a6041922e9fef378333ad3b9ac2333d692b06db1d6425df25d6062b9fc42ec8c50 SHA512 158c4b711e8afc248cbd55f2057dede18540ad35ec1a47d0cfb0fe9bf10b1507bb1b4525badcc0a8b6505062d838ee4fb2d4ebfbf9c9d1694336a704bc0b690e
AUX zlib-1.2.12-CRC-buggy-input.patch 1673 BLAKE2B a45b5c36dc4519f785b29981eaa47de7763fe8a1e65593ad9fd18f4d217e0c9108089ff1b12284728193f76a5cd0cdf3e1e98311cf59302f12eca3143ca3b82e SHA512 a5c5915024c5faca090312500b56c4876bc5b1d7c56253c8b5c192ae499f04cce301dc77d69b2674086366842726552f3a25c3962d26f53e9b5942ce5fb26054
+AUX zlib-1.2.12-CVE-2022-37434.patch 2563 BLAKE2B c2aa6275365965ef5c84668372dde46a2b7579d4f87703ca91332f8473ffa8784772ff3d2105696b5c1b65ca07819a66d4e9c1ef0d6894a44fc78702901647e7 SHA512 6ae143b5de553992c1a5460faae2b309f7e9f049c3afdc5ab7f6cad4479e202affa79b09a058f23dd0f24b07c1a52719b2aa921b4209b2ddbe16caafd6df1cbb
AUX zlib-1.2.12-fix-CC-logic-in-configure.patch 1427 BLAKE2B 7e76e07dc8aef1ee0f38a237a4a37f8c8fa22e1dffe70407781320a325634bc92a0485de7e0de492354672e008f3a689c16087b87c15b1c893f120f5916f906f SHA512 8cdc6fa6754d5d752ae6e59b491cf6f652feb2ea4839d8debf778bbffb0c5dcd1f952a1e7cdb2e01d6e96fe67197db1ad7908c4d9d4f654932cf3deb97cddb16
AUX zlib-1.2.12-use-LDFLAGS-in-configure.patch 2593 BLAKE2B da920b443437d2f912a3c49c2db7478b19268418f94dd70c083ff44640c71b752f84763392300fc3e843a4025910375c058a0648bef65c5ca0db419297d32be8 SHA512 d884348c96da593e3abc7f14f3eea19369c9105c9814e38012e68c53c01a51e260439d18bc7a2bb121965ad1636c774f6cb701c062eba5e79eca4f199005b859
DIST zlib-1.2.11-cygwin-gzopen_w.patch 1170 BLAKE2B fe351436716634bd823da8c2811d332327d335d450d89bee85d7713b09dd454fe6aee264b044a41bf3be603aa36d67943ba6c7d8b46470e180e9b639728b5274 SHA512 14cc63a17fbf6afb6c8a8dd0b92df9807b48e0faf09c88f952083f10716ae62be8de2a0e1424b77fb538605b88898b381160521f2872afdda59e12bd27535c5a
@@ -12,4 +13,5 @@ DIST zlib-1.2.7-cygwin-minizip.patch 2626 BLAKE2B 885f1fda877c0b783618b163702fb4
EBUILD zlib-1.2.11-r4.ebuild 4414 BLAKE2B 28fff60b4ea6e23298dd32bd782c7a174c0c8fac1395f010b3e93769c3de32e7b26cb2a1fdd631c5dafb86d5a2f4f1e87a1833032d2043b629515254eeaccc5f SHA512 eef5a1d3f41a60a672a8432d6ca514d712dbd227c4e74c461193e35482bb47953a905e513f8a67571621e3f68bf12cc201c3a28a6a418f5c8e2b9f3debdc6acb
EBUILD zlib-1.2.11-r5.ebuild 4501 BLAKE2B a1162467779ba8a5d0d3f23c95fd7afeddd427ab1c351472bcc6d0f40efab1ff989682f3963f3428fe28ca77f20cb5f19520c85a43025211dfd8de5a2917cf9f SHA512 7dd887d89dd54f6833d31e7de5095c36e9d312a2fed601b077119ee37da5ac53b69ae56755eaed578bb44f2026a34dfcf125d107e7dee311b842bdad0b9992ca
EBUILD zlib-1.2.12-r2.ebuild 5151 BLAKE2B 699857f73789d3c57387e8a383de99dd9f689acf83662ffb73f57ae96b8dab41908d399209923bcf0efd78b185045ecea14712100df31865cb1ea3e33dcc5c4a SHA512 c7786221d8b50043e12c64abb538faeb458514d464eb45268e8c0b4c6c85ff9ac2c21ade5f6cc545f17ff533224ce1321d58925d32ccc517493d68be1a9ce17a
+EBUILD zlib-1.2.12-r3.ebuild 5216 BLAKE2B 089840eb0d2238813632707bd5f614be0c2ecea96cc4aaf4cad9634ca201ee45964c5131d8bbd7de72ed0fc4ff588a0e138f609a806a878cdec14f8208f903e0 SHA512 016c402fda908514e9a61d31b96eb13280addea05fb0f9fadf351e8db394f9ca0fa92b06abbb8e9d999c889d5781bc4d1a47d06945ff7d1c1464716b5bb57abc
MISC metadata.xml 494 BLAKE2B a4a57a4153aefc189e407bcb8ce84f7c94581cc66967f69097087da7e6ff48d2de683b919fb00445d095c47ef39d31e01590f8c989ce0e5e01474e73ee2a0565 SHA512 a7e0160c127b3c2a6afe99e95992d9dbd017061303759c299ec38800efd6a9e11a35ae850c23c77c09c8833cd9d61ac1267f6becadf9c22437ee35e4304400c9
diff --git a/sys-libs/zlib/files/zlib-1.2.12-CVE-2022-37434.patch b/sys-libs/zlib/files/zlib-1.2.12-CVE-2022-37434.patch
new file mode 100644
index 000000000000..1ef3b909e435
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.12-CVE-2022-37434.patch
@@ -0,0 +1,55 @@
+https://bugs.gentoo.org/863851
+https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1
+https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d (see https://github.com/curl/curl/issues/9271)
+
+From eff308af425b67093bab25f80f1ae950166bece1 Mon Sep 17 00:00:00 2001
+From: Mark Adler <fork@madler.net>
+Date: Sat, 30 Jul 2022 15:51:11 -0700
+Subject: [PATCH] Fix a bug when getting a gzip header extra field with
+ inflate().
+
+If the extra field was larger than the space the user provided with
+inflateGetHeader(), and if multiple calls of inflate() delivered
+the extra header data, then there could be a buffer overflow of the
+provided space. This commit assures that provided space is not
+exceeded.
+--- a/inflate.c
++++ b/inflate.c
+@@ -763,9 +763,10 @@ int flush;
+ copy = state->length;
+ if (copy > have) copy = have;
+ if (copy) {
++ len = state->head->extra_len - state->length;
+ if (state->head != Z_NULL &&
+- state->head->extra != Z_NULL) {
+- len = state->head->extra_len - state->length;
++ state->head->extra != Z_NULL &&
++ len < state->head->extra_max) {
+ zmemcpy(state->head->extra + len, next,
+ len + copy > state->head->extra_max ?
+ state->head->extra_max - len : copy);
+
+From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
+From: Mark Adler <fork@madler.net>
+Date: Mon, 8 Aug 2022 10:50:09 -0700
+Subject: [PATCH] Fix extra field processing bug that dereferences NULL
+ state->head.
+
+The recent commit to fix a gzip header extra field processing bug
+introduced the new bug fixed here.
+--- a/inflate.c
++++ b/inflate.c
+@@ -763,10 +763,10 @@ int flush;
+ copy = state->length;
+ if (copy > have) copy = have;
+ if (copy) {
+- len = state->head->extra_len - state->length;
+ if (state->head != Z_NULL &&
+ state->head->extra != Z_NULL &&
+- len < state->head->extra_max) {
++ (len = state->head->extra_len - state->length) <
++ state->head->extra_max) {
+ zmemcpy(state->head->extra + len, next,
+ len + copy > state->head->extra_max ?
+ state->head->extra_max - len : copy);
+
diff --git a/sys-libs/zlib/zlib-1.2.12-r3.ebuild b/sys-libs/zlib/zlib-1.2.12-r3.ebuild
new file mode 100644
index 000000000000..1117652b5367
--- /dev/null
+++ b/sys-libs/zlib/zlib-1.2.12-r3.ebuild
@@ -0,0 +1,199 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Worth keeping an eye on 'develop' branch upstream for possible backports.
+AUTOTOOLS_AUTO_DEPEND="no"
+VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/madler.asc
+inherit autotools multilib-minimal usr-ldscript verify-sig
+
+CYGWINPATCHES=(
+ "https://github.com/cygwinports/zlib/raw/22a3462cae33a82ad966ea0a7d6cbe8fc1368fec/1.2.11-gzopen_w.patch -> ${PN}-1.2.11-cygwin-gzopen_w.patch"
+ "https://github.com/cygwinports/zlib/raw/22a3462cae33a82ad966ea0a7d6cbe8fc1368fec/1.2.7-minizip-cygwin.patch -> ${PN}-1.2.7-cygwin-minizip.patch"
+)
+
+DESCRIPTION="Standard (de)compression library"
+HOMEPAGE="https://zlib.net/"
+SRC_URI="https://zlib.net/${P}.tar.gz
+ https://zlib.net/fossils/${P}.tar.gz
+ https://www.gzip.org/zlib/${P}.tar.gz
+ https://www.zlib.net/current/beta/${P}.tar.gz
+ verify-sig? ( https://zlib.net/${P}.tar.gz.asc )
+ elibc_Cygwin? ( ${CYGWINPATCHES[*]} )"
+
+LICENSE="ZLIB"
+SLOT="0/1" # subslot = SONAME
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="minizip static-libs"
+
+RDEPEND="!sys-libs/zlib-ng[compat]"
+DEPEND="${RDEPEND}"
+BDEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )
+ verify-sig? ( sec-keys/openpgp-keys-madler )"
+
+PATCHES=(
+ # Don't install unexpected & unused crypt.h header (which would clash with other pkgs)
+ # Pending upstream. bug #658536
+ "${FILESDIR}"/${PN}-1.2.11-minizip-drop-crypt-header.patch
+
+ # Respect AR, RANLIB, NM during build. Pending upstream. bug #831628
+ "${FILESDIR}"/${PN}-1.2.11-configure-fix-AR-RANLIB-NM-detection.patch
+
+ # Respect LDFLAGS during configure tests. Pending upstream
+ "${FILESDIR}"/${PN}-1.2.12-use-LDFLAGS-in-configure.patch
+
+ # Fix broken CC logic
+ "${FILESDIR}"/${P}-fix-CC-logic-in-configure.patch
+
+ # Backport for Java (and others), bug #836370
+ "${FILESDIR}"/${P}-CRC-buggy-input.patch
+
+ # bug #863851
+ "${FILESDIR}"/${P}-CVE-2022-37434.patch
+)
+
+src_prepare() {
+ default
+
+ if use elibc_Cygwin ; then
+ local p
+ for p in "${CYGWINPATCHES[@]}" ; do
+ # Strip out the "... -> " from the array
+ eapply -p2 "${DISTDIR}/${p#*> }"
+ done
+ fi
+
+ if use minizip ; then
+ cd contrib/minizip || die
+ eautoreconf
+ fi
+
+ case ${CHOST} in
+ *-cygwin*)
+ # Do not use _wopen, it's a mingw-only symbol
+ sed -i -e '/define WIDECHAR/d' "${S}"/gzguts.h || die
+
+ # zlib1.dll is the mingw name, need cygz.dll
+ # cygz.dll is loaded by toolchain, put into subdir
+ sed -i -e 's|zlib1.dll|win32/cygz.dll|' win32/Makefile.gcc || die
+
+ ;;
+ esac
+
+ case ${CHOST} in
+ *-mingw*|mingw*|*-cygwin*)
+ # Uses preconfigured Makefile rather than configure script
+ multilib_copy_sources
+
+ ;;
+ esac
+}
+
+echoit() { echo "$@"; "$@"; }
+
+multilib_src_configure() {
+ case ${CHOST} in
+ *-mingw*|mingw*|*-cygwin*)
+ ;;
+
+ *)
+ # bug #347167
+ local uname=$("${BROOT}"/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3)
+
+ local myconf=(
+ --shared
+ --prefix="${EPREFIX}/usr"
+ --libdir="${EPREFIX}/usr/$(get_libdir)"
+ ${uname:+--uname=${uname}}
+ )
+
+ # Not an autoconf script, so can't use econf
+ echoit "${S}"/configure "${myconf[@]}" || die
+
+ ;;
+ esac
+
+ if use minizip ; then
+ local minizipdir="contrib/minizip"
+ mkdir -p "${BUILD_DIR}/${minizipdir}" || die
+
+ cd ${minizipdir} || die
+ ECONF_SOURCE="${S}/${minizipdir}" econf $(use_enable static-libs static)
+ fi
+}
+
+multilib_src_compile() {
+ case ${CHOST} in
+ *-mingw*|mingw*|*-cygwin*)
+ emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}-
+ sed \
+ -e 's|@prefix@|'"${EPREFIX}"'/usr|g' \
+ -e 's|@exec_prefix@|${prefix}|g' \
+ -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
+ -e 's|@includedir@|${prefix}/include|g' \
+ -e 's|@VERSION@|'${PV}'|g' \
+ zlib.pc.in > zlib.pc || die
+ ;;
+
+ *)
+ emake
+
+ ;;
+ esac
+
+ use minizip && emake -C contrib/minizip
+}
+
+sed_macros() {
+ # Clean up namespace a little, bug #383179
+ # We do it here so we only have to tweak 2 files
+ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
+}
+
+multilib_src_install() {
+ case ${CHOST} in
+ *-mingw*|mingw*|*-cygwin*)
+ emake -f win32/Makefile.gcc install \
+ BINARY_PATH="${ED}/usr/bin" \
+ LIBRARY_PATH="${ED}/usr/$(get_libdir)" \
+ INCLUDE_PATH="${ED}/usr/include" \
+ SHARED_MODE=1
+
+ # Overwrites zlib.pc created from win32/Makefile.gcc, bug #620136
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins zlib.pc
+
+ ;;
+
+ *)
+ emake install DESTDIR="${D}" LDCONFIG=:
+ gen_usr_ldscript -a z
+
+ ;;
+ esac
+
+ sed_macros "${ED}"/usr/include/*.h
+
+ if use minizip ; then
+ emake -C contrib/minizip install DESTDIR="${D}"
+ sed_macros "${ED}"/usr/include/minizip/*.h
+ fi
+
+ if use minizip; then
+ # This might not exist if slibtool is used.
+ # bug #816756
+ rm -f "${ED}"/usr/$(get_libdir)/libminizip.la || die
+ fi
+
+ if ! use static-libs ; then
+ # bug #419645
+ rm "${ED}"/usr/$(get_libdir)/libz.a || die
+ fi
+}
+
+multilib_src_install_all() {
+ dodoc FAQ README ChangeLog doc/*.txt
+ use minizip && dodoc contrib/minizip/*.txt
+}