Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/wget/, net-misc/wget/files/
Date: Mon, 06 Nov 2017 21:15:40
Message-Id: 1510002926.4e301458bf4842213e6e97c12487939e4a299abf.whissi@gentoo
1 commit: 4e301458bf4842213e6e97c12487939e4a299abf
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 6 21:15:07 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 6 21:15:26 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e301458
7
8 net-misc/wget: Rev bump to fix segfault
9
10 Bug: http://savannah.gnu.org/bugs/?52349
11 Closes: https://bugs.gentoo.org/636730
12 Package-Manager: Portage-2.3.13, Repoman-2.3.4
13
14 ...-fix-segfault-due-to-derefencing-null-ptr.patch | 66 +++++++++++++
15 net-misc/wget/wget-1.19.2-r1.ebuild | 109 +++++++++++++++++++++
16 2 files changed, 175 insertions(+)
17
18 diff --git a/net-misc/wget/files/wget-1.19.2-fix-segfault-due-to-derefencing-null-ptr.patch b/net-misc/wget/files/wget-1.19.2-fix-segfault-due-to-derefencing-null-ptr.patch
19 new file mode 100644
20 index 00000000000..8a66e08c3e3
21 --- /dev/null
22 +++ b/net-misc/wget/files/wget-1.19.2-fix-segfault-due-to-derefencing-null-ptr.patch
23 @@ -0,0 +1,66 @@
24 +From 973c26ed7d51052a7b6e120ed1b84e47266667e1 Mon Sep 17 00:00:00 2001
25 +From: Darshit Shah <darnir@×××.org>
26 +Date: Mon, 6 Nov 2017 10:09:03 +0100
27 +Subject: Fix Segfault due to derefencing null ptr
28 +MIME-Version: 1.0
29 +Content-Type: text/plain; charset=UTF-8
30 +Content-Transfer-Encoding: 8bit
31 +
32 +* src/http.c(gethttp): When Encoding is gzip, ensure that the
33 +Content-Type Header was actually seen. Without this, the "type" variable
34 +is null causing a Segfault.
35 +
36 +Reported-By: Noël Köthe <noel@××××××.org>
37 +---
38 + src/http.c | 30 +++++++++++++++++++-----------
39 + 1 file changed, 19 insertions(+), 11 deletions(-)
40 +
41 +diff --git a/src/http.c b/src/http.c
42 +index 9954848..2a5454f 100644
43 +--- a/src/http.c
44 ++++ b/src/http.c
45 +@@ -3714,22 +3714,30 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
46 + && opt.compression != compression_none)
47 + {
48 + /* Make sure the Content-Type is not gzip before decompressing */
49 +- const char * p = strchr (type, '/');
50 +- if (p == NULL)
51 +- {
52 +- hs->remote_encoding = ENC_GZIP;
53 +- hs->local_encoding = ENC_NONE;
54 +- }
55 +- else
56 ++ if (type)
57 + {
58 +- p++;
59 +- if (c_tolower(p[0]) == 'x' && p[1] == '-')
60 +- p += 2;
61 +- if (0 != c_strcasecmp (p, "gzip"))
62 ++ const char * p = strchr (type, '/');
63 ++ if (p == NULL)
64 + {
65 + hs->remote_encoding = ENC_GZIP;
66 + hs->local_encoding = ENC_NONE;
67 + }
68 ++ else
69 ++ {
70 ++ p++;
71 ++ if (c_tolower(p[0]) == 'x' && p[1] == '-')
72 ++ p += 2;
73 ++ if (0 != c_strcasecmp (p, "gzip"))
74 ++ {
75 ++ hs->remote_encoding = ENC_GZIP;
76 ++ hs->local_encoding = ENC_NONE;
77 ++ }
78 ++ }
79 ++ }
80 ++ else
81 ++ {
82 ++ hs->remote_encoding = ENC_GZIP;
83 ++ hs->local_encoding = ENC_NONE;
84 + }
85 + }
86 + #endif
87 +--
88 +cgit v1.0-41-gc330
89 +
90
91 diff --git a/net-misc/wget/wget-1.19.2-r1.ebuild b/net-misc/wget/wget-1.19.2-r1.ebuild
92 new file mode 100644
93 index 00000000000..112e811986a
94 --- /dev/null
95 +++ b/net-misc/wget/wget-1.19.2-r1.ebuild
96 @@ -0,0 +1,109 @@
97 +# Copyright 1999-2017 Gentoo Foundation
98 +# Distributed under the terms of the GNU General Public License v2
99 +
100 +EAPI="6"
101 +
102 +PYTHON_COMPAT=( python3_{4,5,6} )
103 +
104 +inherit flag-o-matic python-any-r1 toolchain-funcs
105 +
106 +DESCRIPTION="Network utility to retrieve files from the WWW"
107 +HOMEPAGE="https://www.gnu.org/software/wget/"
108 +SRC_URI="mirror://gnu/wget/${P}.tar.gz"
109 +
110 +LICENSE="GPL-3"
111 +SLOT="0"
112 +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"
113 +IUSE="debug gnutls idn ipv6 libressl nls ntlm pcre +ssl static test uuid zlib"
114 +REQUIRED_USE=" ntlm? ( !gnutls ssl ) gnutls? ( ssl )"
115 +
116 +PATCHES=( "${FILESDIR}"/${PN}-1.19.2-fix-segfault-due-to-derefencing-null-ptr.patch )
117 +
118 +# Force a newer libidn2 to avoid libunistring deps. #612498
119 +LIB_DEPEND="idn? ( >=net-dns/libidn2-0.14[static-libs(+)] )
120 + pcre? ( dev-libs/libpcre[static-libs(+)] )
121 + ssl? (
122 + gnutls? ( net-libs/gnutls:0=[static-libs(+)] )
123 + !gnutls? (
124 + !libressl? ( dev-libs/openssl:0=[static-libs(+)] )
125 + libressl? ( dev-libs/libressl[static-libs(+)] )
126 + )
127 + )
128 + uuid? ( sys-apps/util-linux[static-libs(+)] )
129 + zlib? ( sys-libs/zlib[static-libs(+)] )"
130 +RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
131 +DEPEND="${RDEPEND}
132 + app-arch/xz-utils
133 + virtual/pkgconfig
134 + static? ( ${LIB_DEPEND} )
135 + test? (
136 + ${PYTHON_DEPS}
137 + dev-lang/perl
138 + dev-perl/HTTP-Daemon
139 + dev-perl/HTTP-Message
140 + dev-perl/IO-Socket-SSL
141 + )
142 + nls? ( sys-devel/gettext )"
143 +
144 +DOCS=( AUTHORS MAILING-LIST NEWS README doc/sample.wgetrc )
145 +
146 +pkg_setup() {
147 + use test && python-any-r1_pkg_setup
148 +}
149 +
150 +src_prepare() {
151 + default
152 +
153 + # revert some hack that breaks linking, bug #585924
154 + if [[ ${CHOST} == *-darwin* ]] || [[ ${CHOST} == *-solaris* ]] || [[ ${CHOST} == *-uclibc* ]]; then
155 + sed -i \
156 + -e 's/^ LIBICONV=$/:/' \
157 + configure || die
158 + fi
159 +}
160 +
161 +src_configure() {
162 + # fix compilation on Solaris, we need filio.h for FIONBIO as used in
163 + # the included gnutls -- force ioctl.h to include this header
164 + [[ ${CHOST} == *-solaris* ]] && append-cppflags -DBSD_COMP=1
165 +
166 + if use static ; then
167 + append-ldflags -static
168 + tc-export PKG_CONFIG
169 + PKG_CONFIG+=" --static"
170 + fi
171 +
172 + # There is no flag that controls this. libunistring-prefix only
173 + # controls the search path (which is why we turn it off below).
174 + # Further, libunistring is only needed w/older libidn2 installs,
175 + # and since we force the latest, we can force off libunistring. #612498
176 + ac_cv_libunistring=no \
177 + econf \
178 + --disable-assert \
179 + --disable-rpath \
180 + --without-included-libunistring \
181 + --without-libunistring-prefix \
182 + $(use_enable debug) \
183 + $(use_enable idn iri) \
184 + $(use_enable ipv6) \
185 + $(use_enable nls) \
186 + $(use_enable ntlm) \
187 + $(use_enable pcre) \
188 + $(use_enable ssl digest) \
189 + $(use_enable ssl opie) \
190 + $(use_with idn libidn) \
191 + $(use_with ssl ssl $(usex gnutls gnutls openssl)) \
192 + $(use_with uuid libuuid) \
193 + $(use_with zlib)
194 +}
195 +
196 +src_install() {
197 + default
198 +
199 + sed -i \
200 + -e "s:/usr/local/etc:${EPREFIX}/etc:g" \
201 + "${ED}"/etc/wgetrc \
202 + "${ED}"/usr/share/man/man1/wget.1 \
203 + "${ED}"/usr/share/info/wget.info \
204 + || die
205 +}