public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-arch/upx/, app-arch/upx/files/
@ 2021-03-27 14:26 Conrad Kostecki
  0 siblings, 0 replies; 3+ messages in thread
From: Conrad Kostecki @ 2021-03-27 14:26 UTC (permalink / raw
  To: gentoo-commits

commit:     ec0f3f52f3f3d4dd8a267f5788cd5e440b2f86d2
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Sat Mar 27 12:08:19 2021 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sat Mar 27 14:24:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec0f3f52

app-arch/upx: fix CVE-2021-20285

Patch taken from upstream commit
https://github.com/upx/upx/commit/3781df9da23840e596d5e9e8493f22666802fe6c.

Bug: https://bugs.gentoo.org/778530
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 app-arch/upx/files/upx-3.96_CVE-2021-20285.patch | 76 ++++++++++++++++++++++++
 app-arch/upx/upx-3.96-r1.ebuild                  | 38 ++++++++++++
 2 files changed, 114 insertions(+)

diff --git a/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch b/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch
new file mode 100644
index 00000000000..1d47b2a8bb6
--- /dev/null
+++ b/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch
@@ -0,0 +1,76 @@
+From 3781df9da23840e596d5e9e8493f22666802fe6c Mon Sep 17 00:00:00 2001
+From: John Reiser <jreiser@BitWagon.com>
+Date: Fri, 11 Dec 2020 13:38:18 -0800
+Subject: [PATCH] Check DT_REL/DT_RELA, DT_RELSZ/DT_RELASZ
+
+https://github.com/upx/upx/issues/421
+	modified:   p_lx_elf.cpp
+---
+ src/p_lx_elf.cpp | 34 +++++++++++++++++++++++++++++-----
+ 1 file changed, 29 insertions(+), 5 deletions(-)
+
+diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp
+index 182db192..3a4101cf 100644
+--- a/src/p_lx_elf.cpp
++++ b/src/p_lx_elf.cpp
+@@ -2222,8 +2222,20 @@ bool PackLinuxElf32::canPack()
+                         int z_rsz = dt_table[Elf32_Dyn::DT_RELSZ];
+                         if (z_rel && z_rsz) {
+                             unsigned rel_off = get_te32(&dynseg[-1+ z_rel].d_val);
++                            if ((unsigned)file_size <= rel_off) {
++                                char msg[70]; snprintf(msg, sizeof(msg),
++                                     "bad Elf32_Dynamic[DT_REL] %#x\n",
++                                     rel_off);
++                                throwCantPack(msg);
++                            }
+                             Elf32_Rel *rp = (Elf32_Rel *)&file_image[rel_off];
+                             unsigned relsz   = get_te32(&dynseg[-1+ z_rsz].d_val);
++                            if ((unsigned)file_size <= relsz) {
++                                char msg[70]; snprintf(msg, sizeof(msg),
++                                     "bad Elf32_Dynamic[DT_RELSZ] %#x\n",
++                                     relsz);
++                                throwCantPack(msg);
++                            }
+                             Elf32_Rel *last = (Elf32_Rel *)(relsz + (char *)rp);
+                             for (; rp < last; ++rp) {
+                                 unsigned r_va = get_te32(&rp->r_offset);
+@@ -2562,14 +2574,26 @@ PackLinuxElf64::canPack()
+                         int z_rel = dt_table[Elf64_Dyn::DT_RELA];
+                         int z_rsz = dt_table[Elf64_Dyn::DT_RELASZ];
+                         if (z_rel && z_rsz) {
+-                            unsigned rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
++                            upx_uint64_t rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
++                            if ((u64_t)file_size <= rel_off) {
++                                char msg[70]; snprintf(msg, sizeof(msg),
++                                     "bad Elf64_Dynamic[DT_RELA] %#llx\n",
++                                     rel_off);
++                                throwCantPack(msg);
++                            }
+                             Elf64_Rela *rp = (Elf64_Rela *)&file_image[rel_off];
+-                            unsigned relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
++                            upx_uint64_t relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
++                            if ((u64_t)file_size <= relsz) {
++                                char msg[70]; snprintf(msg, sizeof(msg),
++                                     "bad Elf64_Dynamic[DT_RELASZ] %#llx\n",
++                                     relsz);
++                                throwCantPack(msg);
++                            }
+                             Elf64_Rela *last = (Elf64_Rela *)(relsz + (char *)rp);
+                             for (; rp < last; ++rp) {
+-                                unsigned r_va = get_te64(&rp->r_offset);
++                                upx_uint64_t r_va = get_te64(&rp->r_offset);
+                                 if (r_va == user_init_ava) { // found the Elf64_Rela
+-                                    unsigned r_info = get_te64(&rp->r_info);
++                                    upx_uint64_t r_info = get_te64(&rp->r_info);
+                                     unsigned r_type = ELF64_R_TYPE(r_info);
+                                     if (Elf64_Ehdr::EM_AARCH64 == e_machine
+                                     &&  R_AARCH64_RELATIVE == r_type) {
+@@ -2581,7 +2605,7 @@ PackLinuxElf64::canPack()
+                                     }
+                                     else {
+                                         char msg[50]; snprintf(msg, sizeof(msg),
+-                                            "bad relocation %#x DT_INIT_ARRAY[0]",
++                                            "bad relocation %#llx DT_INIT_ARRAY[0]",
+                                             r_info);
+                                         throwCantPack(msg);
+                                     }

diff --git a/app-arch/upx/upx-3.96-r1.ebuild b/app-arch/upx/upx-3.96-r1.ebuild
new file mode 100644
index 00000000000..26a73f6191a
--- /dev/null
+++ b/app-arch/upx/upx-3.96-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="Ultimate Packer for eXecutables (free version using UCL compression and not NRV)"
+HOMEPAGE="https://upx.github.io/"
+SRC_URI="https://github.com/upx/upx/releases/download/v${PV}/${P}-src.tar.xz"
+
+LICENSE="GPL-2+ UPX-exception" # Read the exception before applying any patches
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE=""
+
+RDEPEND=">=dev-libs/ucl-1.03
+	sys-libs/zlib
+	!app-arch/upx-bin"
+DEPEND="${RDEPEND}
+	dev-lang/perl"
+
+S="${WORKDIR}/${P}-src"
+
+PATCHES=(
+	"${FILESDIR}/${P}_CVE-2021-20285.patch"
+)
+
+src_compile() {
+	tc-export CXX
+	emake CXXFLAGS_WERROR="" all
+}
+
+src_install() {
+	newbin src/upx.out upx
+	dodoc BUGS NEWS PROJECTS README* THANKS doc/*.txt doc/upx.html
+	doman doc/upx.1
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-arch/upx/, app-arch/upx/files/
@ 2022-10-31 22:51 Conrad Kostecki
  0 siblings, 0 replies; 3+ messages in thread
From: Conrad Kostecki @ 2022-10-31 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c5af888421c9b7acf5c5ee521a53c6b88f433a50
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Sun Oct 30 12:38:21 2022 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Mon Oct 31 22:50:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5af8884

app-arch/upx: drop 3.96-r2

Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 app-arch/upx/Manifest                            |  1 -
 app-arch/upx/files/upx-3.96_CVE-2020-24119.patch | 34 -----------
 app-arch/upx/files/upx-3.96_CVE-2021-20285.patch | 76 ------------------------
 app-arch/upx/upx-3.96-r2.ebuild                  | 41 -------------
 4 files changed, 152 deletions(-)

diff --git a/app-arch/upx/Manifest b/app-arch/upx/Manifest
index 305f77a6cf04..d1fc5bbdc5a7 100644
--- a/app-arch/upx/Manifest
+++ b/app-arch/upx/Manifest
@@ -1,2 +1 @@
-DIST upx-3.96-src.tar.xz 792524 BLAKE2B 21af85dbcfdd1bf0151a653c865db13c9f30b9de0b9b4b94557ddd55736c7053dd829c5d72b9a7e5aa94a71ecc0151145dd66d7d98ded178c50ff7357d0ba442 SHA512 2d4d1be21d274d9bfdee9b9815396f5e5ff0bcdfb781b7be5fafa4d1e224028e412ec5f5ba607c482671aae27ccf9069abb2db0fb58f78f3a102a51897df2b11
 DIST upx-4.0.0-src.tar.xz 1159308 BLAKE2B d2626a63b626f9b4e913b822e699fa93b7080d322b19555d44d7cf4ce17b37f0d50ec1381d07d0e4f8827e8edcd29d525d497fa79acd18d520ac58e176fb2b72 SHA512 fe3e8c594e845a91338b1e11fe3cb6371430af40a567187d63835e27da8b2abf993a104b0693063f4db984234bada7b2bd16ad79e3ad90861a1f495d99de7de6

diff --git a/app-arch/upx/files/upx-3.96_CVE-2020-24119.patch b/app-arch/upx/files/upx-3.96_CVE-2020-24119.patch
deleted file mode 100644
index 7e6de04948bd..000000000000
--- a/app-arch/upx/files/upx-3.96_CVE-2020-24119.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 87b73e5cfdc12da94c251b2cd83bb01c7d9f616c Mon Sep 17 00:00:00 2001
-From: John Reiser <jreiser@BitWagon.com>
-Date: Wed, 22 Jul 2020 19:34:27 -0700
-Subject: [PATCH] Unpack: Phdrs must be within expansion of first compressed
- block
-
-https://github.com/upx/upx/issues/388
-	modified:   p_lx_elf.cpp
----
- src/p_lx_elf.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp
-index cd9e4ec97..453d5c457 100644
---- a/src/p_lx_elf.cpp
-+++ b/src/p_lx_elf.cpp
-@@ -4550,7 +4550,7 @@ void PackLinuxElf64::unpack(OutputFile *fo)
-     unsigned c_adler = upx_adler32(NULL, 0);
-     unsigned u_adler = upx_adler32(NULL, 0);
- #define MAX_ELF_HDR 1024
--    if ((MAX_ELF_HDR - sizeof(Elf64_Ehdr))/sizeof(Elf64_Phdr) < u_phnum) {
-+    if ((umin64(MAX_ELF_HDR, ph.u_len) - sizeof(Elf64_Ehdr))/sizeof(Elf64_Phdr) < u_phnum) {
-         throwCantUnpack("bad compressed e_phnum");
-     }
- #undef MAX_ELF_HDR
-@@ -5617,7 +5617,7 @@ void PackLinuxElf32::unpack(OutputFile *fo)
-     unsigned c_adler = upx_adler32(NULL, 0);
-     unsigned u_adler = upx_adler32(NULL, 0);
- #define MAX_ELF_HDR 512
--    if ((MAX_ELF_HDR - sizeof(Elf32_Ehdr))/sizeof(Elf32_Phdr) < u_phnum) {
-+    if ((umin(MAX_ELF_HDR, ph.u_len) - sizeof(Elf32_Ehdr))/sizeof(Elf32_Phdr) < u_phnum) {
-         throwCantUnpack("bad compressed e_phnum");
-     }
- #undef MAX_ELF_HDR

diff --git a/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch b/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch
deleted file mode 100644
index 1d47b2a8bb67..000000000000
--- a/app-arch/upx/files/upx-3.96_CVE-2021-20285.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-From 3781df9da23840e596d5e9e8493f22666802fe6c Mon Sep 17 00:00:00 2001
-From: John Reiser <jreiser@BitWagon.com>
-Date: Fri, 11 Dec 2020 13:38:18 -0800
-Subject: [PATCH] Check DT_REL/DT_RELA, DT_RELSZ/DT_RELASZ
-
-https://github.com/upx/upx/issues/421
-	modified:   p_lx_elf.cpp
----
- src/p_lx_elf.cpp | 34 +++++++++++++++++++++++++++++-----
- 1 file changed, 29 insertions(+), 5 deletions(-)
-
-diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp
-index 182db192..3a4101cf 100644
---- a/src/p_lx_elf.cpp
-+++ b/src/p_lx_elf.cpp
-@@ -2222,8 +2222,20 @@ bool PackLinuxElf32::canPack()
-                         int z_rsz = dt_table[Elf32_Dyn::DT_RELSZ];
-                         if (z_rel && z_rsz) {
-                             unsigned rel_off = get_te32(&dynseg[-1+ z_rel].d_val);
-+                            if ((unsigned)file_size <= rel_off) {
-+                                char msg[70]; snprintf(msg, sizeof(msg),
-+                                     "bad Elf32_Dynamic[DT_REL] %#x\n",
-+                                     rel_off);
-+                                throwCantPack(msg);
-+                            }
-                             Elf32_Rel *rp = (Elf32_Rel *)&file_image[rel_off];
-                             unsigned relsz   = get_te32(&dynseg[-1+ z_rsz].d_val);
-+                            if ((unsigned)file_size <= relsz) {
-+                                char msg[70]; snprintf(msg, sizeof(msg),
-+                                     "bad Elf32_Dynamic[DT_RELSZ] %#x\n",
-+                                     relsz);
-+                                throwCantPack(msg);
-+                            }
-                             Elf32_Rel *last = (Elf32_Rel *)(relsz + (char *)rp);
-                             for (; rp < last; ++rp) {
-                                 unsigned r_va = get_te32(&rp->r_offset);
-@@ -2562,14 +2574,26 @@ PackLinuxElf64::canPack()
-                         int z_rel = dt_table[Elf64_Dyn::DT_RELA];
-                         int z_rsz = dt_table[Elf64_Dyn::DT_RELASZ];
-                         if (z_rel && z_rsz) {
--                            unsigned rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
-+                            upx_uint64_t rel_off = get_te64(&dynseg[-1+ z_rel].d_val);
-+                            if ((u64_t)file_size <= rel_off) {
-+                                char msg[70]; snprintf(msg, sizeof(msg),
-+                                     "bad Elf64_Dynamic[DT_RELA] %#llx\n",
-+                                     rel_off);
-+                                throwCantPack(msg);
-+                            }
-                             Elf64_Rela *rp = (Elf64_Rela *)&file_image[rel_off];
--                            unsigned relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
-+                            upx_uint64_t relsz   = get_te64(&dynseg[-1+ z_rsz].d_val);
-+                            if ((u64_t)file_size <= relsz) {
-+                                char msg[70]; snprintf(msg, sizeof(msg),
-+                                     "bad Elf64_Dynamic[DT_RELASZ] %#llx\n",
-+                                     relsz);
-+                                throwCantPack(msg);
-+                            }
-                             Elf64_Rela *last = (Elf64_Rela *)(relsz + (char *)rp);
-                             for (; rp < last; ++rp) {
--                                unsigned r_va = get_te64(&rp->r_offset);
-+                                upx_uint64_t r_va = get_te64(&rp->r_offset);
-                                 if (r_va == user_init_ava) { // found the Elf64_Rela
--                                    unsigned r_info = get_te64(&rp->r_info);
-+                                    upx_uint64_t r_info = get_te64(&rp->r_info);
-                                     unsigned r_type = ELF64_R_TYPE(r_info);
-                                     if (Elf64_Ehdr::EM_AARCH64 == e_machine
-                                     &&  R_AARCH64_RELATIVE == r_type) {
-@@ -2581,7 +2605,7 @@ PackLinuxElf64::canPack()
-                                     }
-                                     else {
-                                         char msg[50]; snprintf(msg, sizeof(msg),
--                                            "bad relocation %#x DT_INIT_ARRAY[0]",
-+                                            "bad relocation %#llx DT_INIT_ARRAY[0]",
-                                             r_info);
-                                         throwCantPack(msg);
-                                     }

diff --git a/app-arch/upx/upx-3.96-r2.ebuild b/app-arch/upx/upx-3.96-r2.ebuild
deleted file mode 100644
index 14c355bb6351..000000000000
--- a/app-arch/upx/upx-3.96-r2.ebuild
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit toolchain-funcs
-
-DESCRIPTION="Ultimate Packer for eXecutables (free version using UCL compression and not NRV)"
-HOMEPAGE="https://upx.github.io/"
-SRC_URI="https://github.com/upx/upx/releases/download/v${PV}/${P}-src.tar.xz"
-
-LICENSE="GPL-2+ UPX-exception" # Read the exception before applying any patches
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
-IUSE=""
-
-DEPEND=">=dev-libs/ucl-1.03
-	sys-libs/zlib"
-RDEPEND="${RDEPEND}
-	!app-arch/upx-bin"
-BDEPEND="
-	app-arch/xz-utils[extra-filters]
-	dev-lang/perl"
-
-S="${WORKDIR}/${P}-src"
-
-PATCHES=(
-	"${FILESDIR}/${P}_CVE-2020-24119.patch"
-	"${FILESDIR}/${P}_CVE-2021-20285.patch"
-)
-
-src_compile() {
-	tc-export CXX
-	emake CXXFLAGS_WERROR="" all
-}
-
-src_install() {
-	newbin src/upx.out upx
-	dodoc BUGS NEWS PROJECTS README* THANKS doc/*.txt doc/upx.html
-	doman doc/upx.1
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: app-arch/upx/, app-arch/upx/files/
@ 2023-04-21 16:14 David Seifert
  0 siblings, 0 replies; 3+ messages in thread
From: David Seifert @ 2023-04-21 16:14 UTC (permalink / raw
  To: gentoo-commits

commit:     b0b2e526e852b58f2e863b2341eb464462873f20
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Fri Apr 21 16:14:44 2023 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Fri Apr 21 16:14:44 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0b2e526

app-arch/upx: drop 4.0.1-r1

Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 app-arch/upx/Manifest                             |  1 -
 app-arch/upx/files/upx-4.0.1-CVE-2023-23456.patch | 61 -----------------------
 app-arch/upx/files/upx-4.0.1-CVE-2023-23457.patch | 45 -----------------
 app-arch/upx/upx-4.0.1-r1.ebuild                  | 35 -------------
 4 files changed, 142 deletions(-)

diff --git a/app-arch/upx/Manifest b/app-arch/upx/Manifest
index c06784b73e2c..cdaf5d2019f0 100644
--- a/app-arch/upx/Manifest
+++ b/app-arch/upx/Manifest
@@ -1,2 +1 @@
-DIST upx-4.0.1-src.tar.xz 1154032 BLAKE2B 0da23cedf73506e06e5dcf19ab0d194d8e578188bb4d75e760fe3f7dc7f24a9d42ff4b75fd9514162f48ae7cfad347b5bd65789805071354a74129960807843b SHA512 f2e42c83fd4a0d273a20c8b0f0d1eb201edcd1f10c779d2a6e8ac0812741c3af0c887382e54894190ecc4c7002a910524b2ed79ae7a7b595b8392598ad2e1235
 DIST upx-4.0.2-src.tar.xz 1191960 BLAKE2B d1b111d886498628174653e2184bb648862986c6b65441a31ccbbd5360d9fd04d2d8b6cb276111cf4726f38aba0a3cd2c42b6fd62caba69a7996a4e59a5471ca SHA512 0aafbaf97a25e9cd1866d03358f5eceab2c0ba4b2f3acdd58178b41c32af58335b6cb843d83f3398d4ceedc238bfcd95f86a20c38a11d5e4e8af6a28c7e8b82e

diff --git a/app-arch/upx/files/upx-4.0.1-CVE-2023-23456.patch b/app-arch/upx/files/upx-4.0.1-CVE-2023-23456.patch
deleted file mode 100644
index 779800a08e40..000000000000
--- a/app-arch/upx/files/upx-4.0.1-CVE-2023-23456.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 1d291ff0db8a056600ebdebb9c3c62d700eaa842 Mon Sep 17 00:00:00 2001
-From: John Reiser <jreiser@BitWagon.com>
-Date: Thu, 24 Nov 2022 10:28:03 -0800
-Subject: [PATCH] p_tmt: more sanity of input, cleanup MemBuffer usage
-
-https://github.com/upx/upx/issues/632
-	modified:   src/p_tmt.cpp
----
- src/p_tmt.cpp | 23 +++++++++++------------
- 1 file changed, 11 insertions(+), 12 deletions(-)
-
-diff --git a/src/p_tmt.cpp b/src/p_tmt.cpp
-index 7dc72888..592809a9 100644
---- a/src/p_tmt.cpp
-+++ b/src/p_tmt.cpp
-@@ -173,15 +173,13 @@ int PackTmt::readFileHeader()
-     fi->seek(adam_offset,SEEK_SET);
-     fi->readx(&ih,sizeof(ih));
-     // FIXME: should add more checks for the values in 'ih'
--    unsigned const imagesize = get_le32(&ih.imagesize);
--    unsigned const entry     = get_le32(&ih.entry);
--    unsigned const relocsize = get_le32(&ih.relocsize);
--    if (!imagesize
--    ||  file_size <= imagesize
--    ||  file_size <= entry
--    ||  file_size <= relocsize) {
--        printWarn(getName(), "bad header; imagesize=%#x  entry=%#x  relocsize=%#x",
--            imagesize, entry, relocsize);
-+    unsigned const imagesize = ih.imagesize;
-+    unsigned const entry = ih.entry;
-+    unsigned const relocsize = ih.relocsize;
-+    if (imagesize < sizeof(ih) || entry < sizeof(ih) || file_size <= imagesize ||
-+        file_size <= entry || file_size <= relocsize) {
-+        printWarn(getName(), "bad header; imagesize=%#x  entry=%#x  relocsize=%#x", imagesize,
-+                  entry, relocsize);
-         return 0;
-     }
- 
-@@ -215,15 +213,16 @@ void PackTmt::pack(OutputFile *fo)
-     ibuf.alloc(usize+rsize+128);
-     obuf.allocForCompression(usize+rsize+128);
- 
--    MemBuffer wrkmem;
--    wrkmem.alloc(rsize+EXTRA_INFO); // relocations
-+    MemBuffer mb_wrkmem;
-+    mb_wrkmem.alloc(rsize + EXTRA_INFO + 4); // relocations + original entry point + relocsize
-+    SPAN_S_VAR(upx_byte, wrkmem, mb_wrkmem);
- 
-     fi->seek(adam_offset+sizeof(ih),SEEK_SET);
-     fi->readx(ibuf,usize);
-     fi->readx(wrkmem+4,rsize);
-     const unsigned overlay = file_size - fi->tell();
- 
--    if (find_le32(ibuf,128,get_le32("UPX ")) >= 0)
-+    if (find_le32(ibuf, UPX_MIN(128u, usize), get_le32("UPX ")) >= 0)
-         throwAlreadyPacked();
-     if (rsize == 0)
-         throwCantPack("file is already compressed with another packer");
--- 
-2.38.2
-

diff --git a/app-arch/upx/files/upx-4.0.1-CVE-2023-23457.patch b/app-arch/upx/files/upx-4.0.1-CVE-2023-23457.patch
deleted file mode 100644
index 8cb8455b4eab..000000000000
--- a/app-arch/upx/files/upx-4.0.1-CVE-2023-23457.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 779b648c5f6aa9b33f4728f79dd4d0efec0bf860 Mon Sep 17 00:00:00 2001
-From: John Reiser <jreiser@BitWagon.com>
-Date: Wed, 23 Nov 2022 19:49:28 -0800
-Subject: [PATCH] invert_pt_dynamic: fix thinko; PackLinuxElf64help1 insist on
- ELF
-
-https://github.com/upx/upx/issues/631
-	modified:   src/p_lx_elf.cpp
----
- src/p_lx_elf.cpp | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp
-index fa55470f7..b698ee0a2 100644
---- a/src/p_lx_elf.cpp
-+++ b/src/p_lx_elf.cpp
-@@ -256,7 +256,8 @@ PackLinuxElf32::PackLinuxElf32help1(InputFile *f)
-     e_phnum = get_te16(&ehdri.e_phnum);
-     e_shnum = get_te16(&ehdri.e_shnum);
-     unsigned const e_phentsize = get_te16(&ehdri.e_phentsize);
--    if (ehdri.e_ident[Elf32_Ehdr::EI_CLASS]!=Elf32_Ehdr::ELFCLASS32
-+    if (memcmp((char const *)&ehdri, "\x7f\x45\x4c\x46", 4)  // "\177ELF"
-+    || ehdri.e_ident[Elf32_Ehdr::EI_CLASS]!=Elf32_Ehdr::ELFCLASS32
-     || sizeof(Elf32_Phdr) != e_phentsize
-     || (Elf32_Ehdr::ELFDATA2MSB == ehdri.e_ident[Elf32_Ehdr::EI_DATA]
-             && &N_BELE_RTP::be_policy != bele)
-@@ -761,7 +762,8 @@ PackLinuxElf64::PackLinuxElf64help1(InputFile *f)
-     e_phnum = get_te16(&ehdri.e_phnum);
-     e_shnum = get_te16(&ehdri.e_shnum);
-     unsigned const e_phentsize = get_te16(&ehdri.e_phentsize);
--    if (ehdri.e_ident[Elf64_Ehdr::EI_CLASS]!=Elf64_Ehdr::ELFCLASS64
-+    if (memcmp((char const *)&ehdri, "\x7f\x45\x4c\x46", 4)  // "\177ELF"
-+    || ehdri.e_ident[Elf64_Ehdr::EI_CLASS]!=Elf64_Ehdr::ELFCLASS64
-     || sizeof(Elf64_Phdr) != e_phentsize
-     || (Elf64_Ehdr::ELFDATA2MSB == ehdri.e_ident[Elf64_Ehdr::EI_DATA]
-             && &N_BELE_RTP::be_policy != bele)
-@@ -5780,7 +5782,7 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway)
-         }
-         if (file_size <= dt_offsets[n_off]) {
-             char msg[60]; snprintf(msg, sizeof(msg), "bad DT_{%#x} = %#x (beyond EOF)",
--                dt_names[k], dt_offsets[n_off]);
-+                k, dt_offsets[n_off]);
-                 throwCantPack(msg);
-         }
-         n_off += !!dt_offsets[n_off];

diff --git a/app-arch/upx/upx-4.0.1-r1.ebuild b/app-arch/upx/upx-4.0.1-r1.ebuild
deleted file mode 100644
index 16adb6cdbc4e..000000000000
--- a/app-arch/upx/upx-4.0.1-r1.ebuild
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit cmake
-
-DESCRIPTION="Ultimate Packer for eXecutables (free version using UCL compression and not NRV)"
-HOMEPAGE="https://upx.github.io/"
-SRC_URI="https://github.com/upx/upx/releases/download/v${PV}/${P}-src.tar.xz"
-S="${WORKDIR}/${P}-src"
-
-LICENSE="GPL-2+ UPX-exception" # Read the exception before applying any patches
-SLOT="0"
-KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc x86"
-
-RDEPEND="!app-arch/upx-bin"
-BDEPEND="app-arch/xz-utils[extra-filters]"
-
-PATCHES=(
-	"${FILESDIR}/${P}-CVE-2023-23456.patch"
-	"${FILESDIR}/${P}-CVE-2023-23457.patch"
-)
-
-src_configure() {
-	local mycmakeargs=(
-		-DUPX_CONFIG_DISABLE_WERROR=ON
-	)
-	cmake_src_configure
-}
-
-src_test() {
-	# Don't run tests in parallel, #878977
-	cmake_src_test -j1
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-21 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 16:14 [gentoo-commits] repo/gentoo:master commit in: app-arch/upx/, app-arch/upx/files/ David Seifert
  -- strict thread matches above, loose matches on Subject: below --
2022-10-31 22:51 Conrad Kostecki
2021-03-27 14:26 Conrad Kostecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox