Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-arch/p7zip/, app-arch/p7zip/files/
Date: Tue, 08 May 2018 16:55:54
Message-Id: 1525798535.1ec1595e6328e5f68dd1ce669e2841e052360c55.prometheanfire@gentoo
1 commit: 1ec1595e6328e5f68dd1ce669e2841e052360c55
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 8 16:54:37 2018 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Tue May 8 16:55:35 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ec1595e
7
8 app-arch/p7zip: adding 2016 cve
9
10 Package-Manager: Portage-2.3.27, Repoman-2.3.9
11
12 app-arch/p7zip/files/CVE-2016-9296.patch | 12 +++
13 app-arch/p7zip/p7zip-16.02-r3.ebuild | 164 +++++++++++++++++++++++++++++++
14 2 files changed, 176 insertions(+)
15
16 diff --git a/app-arch/p7zip/files/CVE-2016-9296.patch b/app-arch/p7zip/files/CVE-2016-9296.patch
17 new file mode 100644
18 index 00000000000..773f92a46e0
19 --- /dev/null
20 +++ b/app-arch/p7zip/files/CVE-2016-9296.patch
21 @@ -0,0 +1,12 @@
22 +--- ./CPP/7zip/Archive/7z/7zIn.cpp.orig 2016-11-21 01:42:29.460901230 +0000
23 ++++ ./CPP/7zip/Archive/7z/7zIn.cpp 2016-11-21 01:42:57.481197725 +0000
24 +@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedS
25 + if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i])
26 + ThrowIncorrect();
27 + }
28 +- HeadersSize += folders.PackPositions[folders.NumPackStreams];
29 ++ if (folders.PackPositions)
30 ++ HeadersSize += folders.PackPositions[folders.NumPackStreams];
31 + return S_OK;
32 + }
33 +
34
35 diff --git a/app-arch/p7zip/p7zip-16.02-r3.ebuild b/app-arch/p7zip/p7zip-16.02-r3.ebuild
36 new file mode 100644
37 index 00000000000..394b319ac40
38 --- /dev/null
39 +++ b/app-arch/p7zip/p7zip-16.02-r3.ebuild
40 @@ -0,0 +1,164 @@
41 +# Copyright 1999-2018 Gentoo Foundation
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI=6
45 +
46 +WX_GTK_VER="3.0"
47 +
48 +inherit toolchain-funcs wxwidgets
49 +
50 +DESCRIPTION="Port of 7-Zip archiver for Unix"
51 +HOMEPAGE="http://p7zip.sourceforge.net/"
52 +SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_src_all.tar.bz2"
53 +
54 +LICENSE="LGPL-2.1 rar? ( unRAR )"
55 +SLOT="0"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
57 +IUSE="abi_x86_x32 doc kde +pch rar static wxwidgets"
58 +
59 +REQUIRED_USE="kde? ( wxwidgets )"
60 +
61 +RDEPEND="wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
62 +DEPEND="${RDEPEND}
63 + abi_x86_x32? ( >=dev-lang/yasm-1.2.0-r1 )
64 + amd64? ( dev-lang/yasm )
65 + x86? ( dev-lang/nasm )"
66 +
67 +S=${WORKDIR}/${PN}_${PV}
68 +
69 +DOCS=( ChangeLog README TODO )
70 +
71 +PATCHES=(
72 + "${FILESDIR}"/${P}-darwin.patch
73 + "${FILESDIR}"/CVE-2016-9296.patch
74 + "${FILESDIR}"/CVE-2017-17969.patch
75 + "${FILESDIR}"/CVE-2018-5996.patch
76 +)
77 +
78 +src_prepare() {
79 + default
80 +
81 + if ! use pch; then
82 + sed "s:PRE_COMPILED_HEADER=StdAfx.h.gch:PRE_COMPILED_HEADER=:g" -i makefile.* || die
83 + fi
84 +
85 + sed \
86 + -e 's:-m32 ::g' \
87 + -e 's:-m64 ::g' \
88 + -e 's:-pipe::g' \
89 + -e '/ALLFLAGS/s:-s ::' \
90 + -e "/OPTFLAGS=/s:=.*:=${CXXFLAGS}:" \
91 + -i makefile* || die
92 +
93 + # remove non-free RAR codec
94 + if use rar; then
95 + ewarn "Enabling nonfree RAR decompressor"
96 + else
97 + sed \
98 + -e '/Rar/d' \
99 + -e '/RAR/d' \
100 + -i makefile* CPP/7zip/Bundles/Format7zFree/makefile || die
101 + rm -rf CPP/7zip/Compress/Rar || die
102 + fi
103 +
104 + if use abi_x86_x32; then
105 + sed -i -e "/^ASM=/s:amd64:x32:" makefile* || die
106 + cp -f makefile.linux_amd64_asm makefile.machine || die
107 + elif use amd64; then
108 + cp -f makefile.linux_amd64_asm makefile.machine || die
109 + elif use x86; then
110 + cp -f makefile.linux_x86_asm_gcc_4.X makefile.machine || die
111 + elif [[ ${CHOST} == *-darwin* ]] ; then
112 + # Mac OS X needs this special makefile, because it has a non-GNU
113 + # linker, it doesn't matter so much for bitwidth, for it doesn't
114 + # do anything with it
115 + cp -f makefile.macosx_llvm_64bits makefile.machine
116 + # bundles have extension .bundle but don't die because USE=-rar
117 + # removes the Rar directory
118 + sed -i -e '/strcpy(name/s/\.so/.bundle/' \
119 + CPP/Windows/DLL.cpp || die
120 + sed -i -e '/^PROG=/s/\.so/.bundle/' \
121 + CPP/7zip/Bundles/Format7zFree/makefile.list \
122 + $(use rar && echo CPP/7zip/Compress/Rar/makefile.list) || die
123 + elif use x86-fbsd; then
124 + # FreeBSD needs this special makefile, because it hasn't -ldl
125 + sed -e 's/-lc_r/-pthread/' makefile.freebsd > makefile.machine
126 + fi
127 +
128 + if use static; then
129 + sed -i -e '/^LOCAL_LIBS=/s/LOCAL_LIBS=/&-static /' makefile.machine || die
130 + fi
131 +
132 + if use kde || use wxwidgets; then
133 + need-wxwidgets unicode
134 + einfo "Preparing dependency list"
135 + emake depend
136 + fi
137 +}
138 +
139 +src_compile() {
140 + emake CC=$(tc-getCC) CXX=$(tc-getCXX) all3
141 + if use kde || use wxwidgets; then
142 + emake CC=$(tc-getCC) CXX=$(tc-getCXX) -- 7zG
143 +# emake -- 7zFM
144 + fi
145 +}
146 +
147 +src_test() {
148 + emake test test_7z test_7zr
149 +}
150 +
151 +src_install() {
152 + # this wrappers can not be symlinks, p7zip should be called with full path
153 + make_wrapper 7zr "/usr/$(get_libdir)/${PN}/7zr"
154 + make_wrapper 7za "/usr/$(get_libdir)/${PN}/7za"
155 + make_wrapper 7z "/usr/$(get_libdir)/${PN}/7z"
156 +
157 + if use kde || use wxwidgets; then
158 + make_wrapper 7zG "/usr/$(get_libdir)/${PN}/7zG"
159 +# make_wrapper 7zFM "/usr/$(get_libdir)/${PN}/7zFM"
160 +
161 +# make_desktop_entry 7zFM "${PN} FM" ${PN} "GTK;Utility;Archiving;Compression"
162 +
163 + dobin GUI/p7zipForFilemanager
164 + exeinto /usr/$(get_libdir)/${PN}
165 +# doexe bin/7z{G,FM}
166 + doexe bin/7zG
167 +
168 + insinto /usr/$(get_libdir)/${PN}
169 + doins -r GUI/Lang
170 + doins -r DOC/MANUAL
171 +
172 + insinto /usr/share/icons/hicolor/16x16/apps/
173 + newins GUI/p7zip_16_ok.png p7zip.png
174 +
175 + if use kde; then
176 + rm GUI/kde4/p7zip_compress.desktop || die
177 + insinto /usr/share/kservices5/ServiceMenus
178 + doins GUI/kde4/*.desktop
179 + dodir /usr/share/kde4/services/ServiceMenus # drop these lines after konqueror:4/krusader:4 are gone
180 + for item in "${ED}"usr/share/kservices5/ServiceMenus/*.desktop; do
181 + item="$(basename ${item})"
182 + dosym "/usr/share/kservices5/ServiceMenus/${item}" "/usr/share/kde4/services/ServiceMenus/${item}"
183 + done
184 + fi
185 + fi
186 +
187 + dobin contrib/gzip-like_CLI_wrapper_for_7z/p7zip
188 + doman contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1
189 +
190 + exeinto /usr/$(get_libdir)/${PN}
191 + doexe bin/7z bin/7za bin/7zr bin/7zCon.sfx
192 + doexe bin/*$(get_modname)
193 + if use rar; then
194 + exeinto /usr/$(get_libdir)/${PN}/Codecs/
195 + doexe bin/Codecs/*$(get_modname)
196 + fi
197 +
198 + doman man1/7z.1 man1/7za.1 man1/7zr.1
199 +
200 + if use doc; then
201 + dodoc DOC/*.txt
202 + dohtml -r DOC/MANUAL/*
203 + fi
204 +}