From c74ea15767657bee72ad95cc7595b3dac8a1a900 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 23 Jan 2023 07:20:45 +0000 Subject: [PATCH] app-arch/pigz: Sync with Gentoo It's from Gentoo commit 8a1a91aa281cd0c6f2d3c2054ed9c866a04d594d. --- .../pigz/files/pigz-2.7-memcpy-ub.patch | 26 +++++++++++++ .../app-arch/pigz/pigz-2.7-r1.ebuild | 38 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch create mode 100644 sdk_container/src/third_party/portage-stable/app-arch/pigz/pigz-2.7-r1.ebuild diff --git a/sdk_container/src/third_party/portage-stable/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch b/sdk_container/src/third_party/portage-stable/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch new file mode 100644 index 0000000000..db53660748 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-arch/pigz/files/pigz-2.7-memcpy-ub.patch @@ -0,0 +1,26 @@ +https://github.com/madler/pigz/commit/e1ed230a1599a3cb64c8f5c003cced60e10e3314 +https://github.com/madler/pigz/issues/107 + +From e1ed230a1599a3cb64c8f5c003cced60e10e3314 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Sat, 31 Dec 2022 21:28:26 -0800 +Subject: [PATCH] Avoid calling memcpy() with a NULL pointer. + +This is not permitted by the C99 standard even when the length is +zero. Go figure. +--- a/pigz.c ++++ b/pigz.c +@@ -3414,8 +3414,10 @@ local int outb(void *desc, unsigned char *buf, unsigned len) { + + // copy the output and alert the worker bees + out_len = len; +- g.out_tot += len; +- memcpy(out_copy, buf, len); ++ if (len) { ++ g.out_tot += len; ++ memcpy(out_copy, buf, len); ++ } + twist(outb_write_more, TO, 1); + twist(outb_check_more, TO, 1); + + diff --git a/sdk_container/src/third_party/portage-stable/app-arch/pigz/pigz-2.7-r1.ebuild b/sdk_container/src/third_party/portage-stable/app-arch/pigz/pigz-2.7-r1.ebuild new file mode 100644 index 0000000000..f0a9d1f454 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/app-arch/pigz/pigz-2.7-r1.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs flag-o-matic + +DESCRIPTION="A parallel implementation of gzip" +HOMEPAGE="https://www.zlib.net/pigz/" +SRC_URI="https://www.zlib.net/pigz/${P}.tar.gz" + +LICENSE="ZLIB" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~ppc-macos ~sparc64-solaris" +IUSE="static test" +RESTRICT="!test? ( test )" + +LIB_DEPEND="sys-libs/zlib[static-libs(+)]" +RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )" +DEPEND="${RDEPEND} + static? ( ${LIB_DEPEND} ) + test? ( app-arch/ncompress )" + +PATCHES=( + "${FILESDIR}"/${P}-memcpy-ub.patch +) + +src_compile() { + use static && append-ldflags -static + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" +} + +src_install() { + dobin ${PN} + dosym ${PN} /usr/bin/un${PN} + dodoc README + doman ${PN}.1 +}