Hello community, here is the log from the commit of package upx for openSUSE:Factory checked in at 2017-10-09 19:46:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/upx (Old) and /work/SRC/openSUSE:Factory/.upx.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "upx" Mon Oct 9 19:46:35 2017 rev:11 rq:532587 version:3.94 Changes: -------- --- /work/SRC/openSUSE:Factory/upx/upx.changes 2014-11-19 20:30:22.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.upx.new/upx.changes 2017-10-09 19:48:34.318658772 +0200 @@ -1,0 +2,12 @@ +Fri Oct 6 13:44:12 UTC 2017 - [email protected] + +- Update to new upstream release 3.94 + * Add support for arm64-linux (aka aarch64). + * Add support for --lzma compression on 64-bit PowerPC. + * From 3.92: + * Explicitly diagnose Go-language bad PT_LOAD. +- Resolve apply/merge conflict of upx-endiantests.patch +- Add 0001-Protect-against-bad-crafted-input.patch, + 0002-Protect-against-bad-crafted-input.patch [boo#1062059] + +------------------------------------------------------------------- Old: ---- upx-3.91-src.tar.bz2 New: ---- 0001-Protect-against-bad-crafted-input.patch 0002-Protect-against-bad-crafted-input.patch upx-3.94-src.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ upx.spec ++++++ --- /var/tmp/diff_new_pack.GtsoK0/_old 2017-10-09 19:48:34.990629239 +0200 +++ /var/tmp/diff_new_pack.GtsoK0/_new 2017-10-09 19:48:34.994629063 +0200 @@ -1,7 +1,7 @@ # # spec file for package upx # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: upx -Version: 3.91 +Version: 3.94 Release: 0 Summary: The Ultimate Packer for eXecutables License: GPL-2.0+ Group: Development/Tools/Other -Url: http://upx.sourceforge.net/ +Url: https://upx.github.io/ -Source: http://upx.sourceforge.net/download/%{name}-%{version}-src.tar.bz2 +Source: https://github.com/upx/upx/releases/download/v%{version}/upx-%{version}-src.tar.xz Source1: http://downloads.sf.net/sevenzip/lzma922.tar.bz2 BuildRequires: gcc-c++ BuildRequires: libucl1-devel @@ -33,6 +33,8 @@ Patch0: upx-aarch64.patch Patch1: upx-endiantests.patch Patch2: lzma-x-endian.patch +Patch3: 0001-Protect-against-bad-crafted-input.patch +Patch4: 0002-Protect-against-bad-crafted-input.patch %description UPX is a free, portable, extendable, high-performance executable packer @@ -49,16 +51,20 @@ tar -xf "%{S:1}" %patch2 -p1 popd +%patch3 -p1 +%patch4 -p1 # BSD-4 clause licensed file, remove just in case bnc#753791 rm src/stub/src/i386-dos32.djgpp2-stubify.asm %build -export UPX_LZMADIR="%_builddir/lzma-x" +export UPX_LZMADIR="%{_builddir}/lzma-x" export UPX_LZMA_VERSION=0x922 export UPX_UCLDIR=%{_prefix} export CXX=g++ -make -C src CXXFLAGS="%{optflags} -fvisibility=hidden -fvisibility-inlines-hidden" +# silly whitespace checker runs over all files and chokes on upx.out +make %{?_smp_mflags} -C src CHECK_WHITESPACE=/bin/true \ + CXXFLAGS_OPTIMIZE="%{optflags} -fvisibility=hidden -fvisibility-inlines-hidden" make -C doc %install ++++++ 0001-Protect-against-bad-crafted-input.patch ++++++ >From ef336dbcc6dc8344482f8cf6c909ae96c3286317 Mon Sep 17 00:00:00 2001 From: John Reiser <[email protected]> Date: Mon, 2 Oct 2017 21:47:40 -0700 Subject: [PATCH 1/2] Protect against bad crafted input. https://github.com/upx/upx/issues/128 modified: p_lx_elf.cpp --- src/p_lx_elf.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index e6336425..9272cf9b 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -245,8 +245,15 @@ PackLinuxElf32::PackLinuxElf32help1(InputFile *f) sz_phdrs = 0; return; } + if (0==e_phnum) throwCantUnpack("0==e_phnum"); e_phoff = get_te32(&ehdri.e_phoff); + if ((unsigned long)file_size < ((unsigned long)e_phoff + e_phnum * sizeof(Elf32_Phdr))) { + throwCantUnpack("bad e_phoff"); + } e_shoff = get_te32(&ehdri.e_shoff); + if ((unsigned long)file_size < ((unsigned long)e_shoff + e_shnum * sizeof(Elf32_Shdr))) { + throwCantUnpack("bad e_shoff"); + } sz_phdrs = e_phnum * e_phentsize; if (f && Elf32_Ehdr::ET_DYN!=e_type) { @@ -661,8 +668,15 @@ PackLinuxElf64::PackLinuxElf64help1(InputFile *f) sz_phdrs = 0; return; } + if (0==e_phnum) throwCantUnpack("0==e_phnum"); e_phoff = get_te64(&ehdri.e_phoff); + if ((unsigned long)file_size < (e_phoff + e_phnum * sizeof(Elf64_Phdr))) { + throwCantUnpack("bad e_phoff"); + } e_shoff = get_te64(&ehdri.e_shoff); + if ((unsigned long)file_size < (e_shoff + e_shnum * sizeof(Elf64_Shdr))) { + throwCantUnpack("bad e_shoff"); + } sz_phdrs = e_phnum * e_phentsize; if (f && Elf64_Ehdr::ET_DYN!=e_type) { @@ -3490,6 +3504,9 @@ void PackLinuxElf64::pack4(OutputFile *fo, Filter &ft) void PackLinuxElf64::unpack(OutputFile *fo) { + if (e_phoff != sizeof(Elf64_Ehdr)) {// Phdrs not contiguous with Ehdr + throwCantUnpack("bad e_phoff"); + } unsigned const c_phnum = get_te16(&ehdri.e_phnum); upx_uint64_t old_data_off = 0; upx_uint64_t old_data_len = 0; @@ -4110,6 +4127,9 @@ Elf64_Sym const *PackLinuxElf64::elf_lookup(char const *name) const void PackLinuxElf32::unpack(OutputFile *fo) { + if (e_phoff != sizeof(Elf32_Ehdr)) {// Phdrs not contiguous with Ehdr + throwCantUnpack("bad e_phoff"); + } unsigned const c_phnum = get_te16(&ehdri.e_phnum); unsigned old_data_off = 0; unsigned old_data_len = 0; -- 2.14.2 ++++++ 0002-Protect-against-bad-crafted-input.patch ++++++ >From 7bace76176148e5a12d91b467029fee0f3106ac1 Mon Sep 17 00:00:00 2001 From: John Reiser <[email protected]> Date: Tue, 3 Oct 2017 09:55:34 -0700 Subject: [PATCH 2/2] Protect against bad crafted input. https://github.com/upx/upx/issues/129 modified: p_lx_elf.cpp --- src/p_lx_elf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 9272cf9b..37a95720 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -3572,6 +3572,9 @@ void PackLinuxElf64::unpack(OutputFile *fo) unsigned total_out = 0; unsigned c_adler = upx_adler32(NULL, 0); unsigned u_adler = upx_adler32(NULL, 0); + if ((MAX_ELF_HDR - sizeof(Elf64_Ehdr))/sizeof(Elf64_Phdr) < u_phnum) { + throwCantUnpack("bad compressed e_phnum"); + } // Packed ET_EXE has no PT_DYNAMIC. // Packed ET_DYN has original PT_DYNAMIC for info needed by rtld. @@ -4196,6 +4199,9 @@ void PackLinuxElf32::unpack(OutputFile *fo) unsigned total_out = 0; unsigned c_adler = upx_adler32(NULL, 0); unsigned u_adler = upx_adler32(NULL, 0); + if ((MAX_ELF_HDR - sizeof(Elf32_Ehdr))/sizeof(Elf32_Phdr) < u_phnum) { + throwCantUnpack("bad compressed e_phnum"); + } // Packed ET_EXE has no PT_DYNAMIC. // Packed ET_DYN has original PT_DYNAMIC for info needed by rtld. -- 2.14.2 ++++++ upx-endiantests.patch ++++++ --- /var/tmp/diff_new_pack.GtsoK0/_old 2017-10-09 19:48:35.074625547 +0200 +++ /var/tmp/diff_new_pack.GtsoK0/_new 2017-10-09 19:48:35.074625547 +0200 @@ -1,6 +1,13 @@ ---- upx-3.91-src.orig/src/miniacc.h -+++ upx-3.91-src/src/miniacc.h -@@ -1966,46 +1966,15 @@ ACC_COMPILE_TIME_ASSERT_HEADER(ACC_SIZEO +--- + src/miniacc.h | 53 ++++------------------------------------- + src/stub/tools/sstrip/sstrip.c | 4 +-- + 2 files changed, 8 insertions(+), 49 deletions(-) + +Index: upx-3.94-src/src/miniacc.h +=================================================================== +--- upx-3.94-src.orig/src/miniacc.h ++++ upx-3.94-src/src/miniacc.h +@@ -2503,53 +2503,12 @@ ACC_COMPILE_TIME_ASSERT_HEADER(ACC_SIZEO # undef ACC_ABI_BIG_ENDIAN # undef ACC_ABI_LITTLE_ENDIAN #elif !(ACC_ABI_BIG_ENDIAN) && !(ACC_ABI_LITTLE_ENDIAN) @@ -8,7 +15,7 @@ -# define ACC_ABI_BIG_ENDIAN 1 -#elif (ACC_ARCH_IA64) && (ACC_OS_POSIX_LINUX || ACC_OS_WIN64) -# define ACC_ABI_LITTLE_ENDIAN 1 --#elif (ACC_ARCH_ALPHA || ACC_ARCH_AMD64 || ACC_ARCH_BLACKFIN || ACC_ARCH_CRIS || ACC_ARCH_I086 || ACC_ARCH_I386 || ACC_ARCH_MSP430) +-#elif (ACC_ARCH_ALPHA || ACC_ARCH_AMD64 || ACC_ARCH_BLACKFIN || ACC_ARCH_CRIS || ACC_ARCH_I086 || ACC_ARCH_I386 || ACC_ARCH_MSP430 || ACC_ARCH_RISCV) -# define ACC_ABI_LITTLE_ENDIAN 1 -#elif (ACC_ARCH_AVR32 || ACC_ARCH_M68K || ACC_ARCH_S390 || ACC_ARCH_SPU) -# define ACC_ABI_BIG_ENDIAN 1 @@ -22,10 +29,14 @@ -# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) -# define ACC_ABI_LITTLE_ENDIAN 1 +-#elif 1 && (ACC_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) +-# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && (ACC_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) -# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && (ACC_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) -# define ACC_ABI_LITTLE_ENDIAN 1 +-#elif 1 && (ACC_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32) +-# define ACC_ABI_LITTLE_ENDIAN 1 -#elif 1 && (ACC_ARCH_ARM && ACC_CC_ARMCC_ARMCC) -# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) -# error "unexpected configuration - check your compiler defines" @@ -35,28 +46,31 @@ -# define ACC_ABI_LITTLE_ENDIAN 1 -# endif -# define ACC_ABI_LITTLE_ENDIAN 1 +-#elif 1 && (ACC_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) +-# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && (ACC_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) -# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && (ACC_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) -# define ACC_ABI_LITTLE_ENDIAN 1 +-#elif 1 && (ACC_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32) +-# define ACC_ABI_LITTLE_ENDIAN 1 -#elif 1 && (ACC_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) -# define ACC_ABI_BIG_ENDIAN 1 -#elif 1 && (ACC_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) -# define ACC_ABI_LITTLE_ENDIAN 1 -+ -+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -+#define ACC_ABI_LITTLE_ENDIAN 1 -+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -+#define ACC_ABI_BIG_ENDIAN 1 ++# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ++# define ACC_ABI_LITTLE_ENDIAN 1 ++# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ ++# define ACC_ABI_BIG_ENDIAN 1 +#else -+#error unknown endianess WTF! ++# error unknown endianess WTF! #endif -+ #endif #if (ACC_ABI_BIG_ENDIAN) && (ACC_ABI_LITTLE_ENDIAN) - # error "unexpected configuration - check your compiler defines" ---- upx-3.91-src.orig/src/stub/tools/sstrip/sstrip.c -+++ upx-3.91-src/src/stub/tools/sstrip/sstrip.c +Index: upx-3.94-src/src/stub/tools/sstrip/sstrip.c +=================================================================== +--- upx-3.94-src.orig/src/stub/tools/sstrip/sstrip.c ++++ upx-3.94-src/src/stub/tools/sstrip/sstrip.c @@ -331,14 +331,14 @@ static int readelfheaderident(int fd, El /* Compare the file's class and endianness with the program's.
