Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/freetype/files/, media-libs/freetype/
Date: Fri, 10 Mar 2017 11:40:55
Message-Id: 1489146047.b718d16b1e7331ab125b9803d1add14b2617e0b0.polynomial-c@gentoo
1 commit: b718d16b1e7331ab125b9803d1add14b2617e0b0
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 10 11:40:30 2017 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 10 11:40:47 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b718d16b
7
8 media-libs/freetype: Security revbump for bug #612192.
9
10 Package-Manager: Portage-2.3.4, Repoman-2.3.2
11
12 .../freetype/files/freetype-2.7.1-glyph_name.patch | 31 ++++
13 media-libs/freetype/freetype-2.7.1-r2.ebuild | 179 +++++++++++++++++++++
14 2 files changed, 210 insertions(+)
15
16 diff --git a/media-libs/freetype/files/freetype-2.7.1-glyph_name.patch b/media-libs/freetype/files/freetype-2.7.1-glyph_name.patch
17 new file mode 100644
18 index 00000000000..99c27a7a02f
19 --- /dev/null
20 +++ b/media-libs/freetype/files/freetype-2.7.1-glyph_name.patch
21 @@ -0,0 +1,31 @@
22 +From a660e3de422731b94d4a134d27555430cbb6fb39 Mon Sep 17 00:00:00 2001
23 +From: Werner Lemberg <wl@×××.org>
24 +Date: Fri, 26 Aug 2016 00:23:27 +0200
25 +Subject: [PATCH] [type1] Fix heap buffer overflow.
26 +
27 +Reported as
28 +
29 + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36
30 +
31 +* src/type1/t1load.c (parse_charstrings): Reject fonts that don't
32 +contain glyph names.
33 +---
34 +diff --git a/src/type1/t1load.c b/src/type1/t1load.c
35 +index c981adcf..f8bf3132 100644
36 +--- a/src/type1/t1load.c
37 ++++ b/src/type1/t1load.c
38 +@@ -1776,6 +1776,12 @@
39 + }
40 + }
41 +
42 ++ if ( !n )
43 ++ {
44 ++ error = FT_THROW( Invalid_File_Format );
45 ++ goto Fail;
46 ++ }
47 ++
48 + loader->num_glyphs = n;
49 +
50 + /* if /.notdef is found but does not occupy index 0, do our magic. */
51 +--
52 +2.12.0
53
54 diff --git a/media-libs/freetype/freetype-2.7.1-r2.ebuild b/media-libs/freetype/freetype-2.7.1-r2.ebuild
55 new file mode 100644
56 index 00000000000..498c3a7df4f
57 --- /dev/null
58 +++ b/media-libs/freetype/freetype-2.7.1-r2.ebuild
59 @@ -0,0 +1,179 @@
60 +# Copyright 1999-2017 Gentoo Foundation
61 +# Distributed under the terms of the GNU General Public License v2
62 +
63 +EAPI=6
64 +
65 +inherit flag-o-matic libtool multilib multilib-build multilib-minimal toolchain-funcs
66 +
67 +INFINALITY_PATCH="03-infinality-2.6.3-2016.03.26.patch"
68 +
69 +DESCRIPTION="A high-quality and portable font engine"
70 +HOMEPAGE="http://www.freetype.org/"
71 +SRC_URI="mirror://sourceforge/freetype/${P/_/}.tar.bz2
72 + mirror://nongnu/freetype/${P/_/}.tar.bz2
73 + utils? ( mirror://sourceforge/freetype/ft2demos-${PV}.tar.bz2
74 + mirror://nongnu/freetype/ft2demos-${PV}.tar.bz2 )
75 + doc? ( mirror://sourceforge/freetype/${PN}-doc-${PV}.tar.bz2
76 + mirror://nongnu/freetype/${PN}-doc-${PV}.tar.bz2 )"
77 +
78 +LICENSE="|| ( FTL GPL-2+ )"
79 +SLOT="2"
80 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
81 +IUSE="X +adobe-cff bindist bzip2 +cleartype_hinting debug doc fontforge harfbuzz
82 + infinality png static-libs utils"
83 +RESTRICT="!bindist? ( bindist )" # bug 541408
84 +
85 +CDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
86 + bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
87 + harfbuzz? ( >=media-libs/harfbuzz-0.9.19[truetype,${MULTILIB_USEDEP}] )
88 + png? ( >=media-libs/libpng-1.2.51:=[${MULTILIB_USEDEP}] )
89 + utils? (
90 + X? (
91 + >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
92 + >=x11-libs/libXau-1.0.7-r1[${MULTILIB_USEDEP}]
93 + >=x11-libs/libXdmcp-1.1.1-r1[${MULTILIB_USEDEP}]
94 + )
95 + )"
96 +DEPEND="${CDEPEND}
97 + virtual/pkgconfig"
98 +RDEPEND="${CDEPEND}
99 + abi_x86_32? ( utils? ( !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)] ) )"
100 +PDEPEND="infinality? ( media-libs/fontconfig-infinality )"
101 +
102 +PATCHES=(
103 + # This is the same as the 01 patch from infinality
104 + "${FILESDIR}"/${PN}-2.7-enable-valid.patch
105 +
106 + "${FILESDIR}"/${PN}-2.4.11-sizeof-types.patch # 459966
107 +
108 + # patches from upstream (can be removed with the next version bump)
109 + "${FILESDIR}"/${P}-pcf_fix.patch #606688
110 + "${FILESDIR}"/${P}-glyph_name.patch #612192
111 +)
112 +
113 +src_prepare() {
114 + enable_option() {
115 + sed -i -e "/#define $1/ { s:/\* ::; s: \*/:: }" \
116 + include/${PN}/config/ftoption.h \
117 + || die "unable to enable option $1"
118 + }
119 +
120 + disable_option() {
121 + sed -i -e "/#define $1/ { s:^:/* :; s:$: */: }" \
122 + include/${PN}/config/ftoption.h \
123 + || die "unable to disable option $1"
124 + }
125 +
126 + default
127 +
128 + # Will be the new default for >=freetype-2.7.0
129 + disable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING 2"
130 +
131 + if use infinality && use cleartype_hinting; then
132 + enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 )"
133 + elif use infinality; then
134 + enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING 1"
135 + elif use cleartype_hinting; then
136 + enable_option "TT_CONFIG_OPTION_SUBPIXEL_HINTING 2"
137 + fi
138 +
139 + if ! use bindist; then
140 + # See http://freetype.org/patents.html
141 + # ClearType is covered by several Microsoft patents in the US
142 + enable_option FT_CONFIG_OPTION_SUBPIXEL_RENDERING
143 + fi
144 +
145 + if ! use adobe-cff; then
146 + enable_option CFF_CONFIG_OPTION_OLD_ENGINE
147 + fi
148 +
149 + if use debug; then
150 + enable_option FT_DEBUG_LEVEL_TRACE
151 + enable_option FT_DEBUG_MEMORY
152 + fi
153 +
154 + if use utils; then
155 + cd "${WORKDIR}/ft2demos-${PV}" || die
156 + # Disable tests needing X11 when USE="-X". (bug #177597)
157 + if ! use X; then
158 + sed -i -e "/EXES\ +=\ ftdiff/ s:^:#:" Makefile || die
159 + fi
160 + cd "${S}" || die
161 + fi
162 +
163 + # we need non-/bin/sh to run configure
164 + if [[ -n ${CONFIG_SHELL} ]] ; then
165 + sed -i -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \
166 + "${S}"/builds/unix/configure || die
167 + fi
168 +
169 + elibtoolize --patch-only
170 +}
171 +
172 +multilib_src_configure() {
173 + append-flags -fno-strict-aliasing
174 + type -P gmake &> /dev/null && export GNUMAKE=gmake
175 +
176 + local myeconfargs=(
177 + --enable-biarch-config
178 + --enable-shared
179 + $(use_with bzip2)
180 + $(use_with harfbuzz)
181 + $(use_with png)
182 + $(use_enable static-libs static)
183 +
184 + # avoid using libpng-config
185 + LIBPNG_CFLAGS="$($(tc-getPKG_CONFIG) --cflags libpng)"
186 + LIBPNG_LDFLAGS="$($(tc-getPKG_CONFIG) --libs libpng)"
187 + )
188 +
189 + ECONF_SOURCE="${S}" \
190 + econf "${myeconfargs[@]}"
191 +}
192 +
193 +multilib_src_compile() {
194 + default
195 +
196 + if multilib_is_native_abi && use utils; then
197 + einfo "Building utils"
198 + # fix for Prefix, bug #339334
199 + emake \
200 + X11_PATH="${EPREFIX}/usr/$(get_libdir)" \
201 + FT2DEMOS=1 TOP_DIR_2="${WORKDIR}/ft2demos-${PV}"
202 + fi
203 +}
204 +
205 +multilib_src_install() {
206 + default
207 +
208 + if multilib_is_native_abi && use utils; then
209 + einfo "Installing utils"
210 + rm "${WORKDIR}"/ft2demos-${PV}/bin/README || die
211 + local ft2demo
212 + for ft2demo in ../ft2demos-${PV}/bin/*; do
213 + ./libtool --mode=install $(type -P install) -m 755 "$ft2demo" \
214 + "${ED}"/usr/bin || die
215 + done
216 + fi
217 +}
218 +
219 +multilib_src_install_all() {
220 + if use fontforge; then
221 + # Probably fontforge needs less but this way makes things simplier...
222 + einfo "Installing internal headers required for fontforge"
223 + local header
224 + find src/truetype include/freetype/internal -name '*.h' | \
225 + while read header; do
226 + mkdir -p "${ED}/usr/include/freetype2/internal4fontforge/$(dirname ${header})" || die
227 + cp ${header} "${ED}/usr/include/freetype2/internal4fontforge/$(dirname ${header})" || die
228 + done
229 + fi
230 +
231 + dodoc docs/{CHANGES,CUSTOMIZE,DEBUG,INSTALL.UNIX,*.txt,PROBLEMS,TODO}
232 + if use doc ; then
233 + docinto html
234 + dodoc -r docs/*
235 + fi
236 +
237 + prune_libtool_files --all
238 +}