Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/vorbis-tools/, media-sound/vorbis-tools/files/
Date: Sat, 29 Jul 2017 10:52:43
Message-Id: 1501324842.5b60b4cd7ed6c51f086f57a39a1dbf9cebffc825.aballier@gentoo
1 commit: 5b60b4cd7ed6c51f086f57a39a1dbf9cebffc825
2 Author: Christopher Díaz <christopher.diaz.riv <AT> gmail <DOT> com>
3 AuthorDate: Sun Jul 23 15:17:30 2017 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 29 10:40:42 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b60b4cd
7
8 media-sound/vorbis-tools: multiple security fixes
9
10 https://bugs.gentoo.org/show_bug.cgi?id=537422
11 https://bugs.gentoo.org/show_bug.cgi?id=559170
12
13 .../files/vorbis-tools-1.4.0-CVE-2014-9638.patch | 92 ++++++++++++++++++++++
14 .../files/vorbis-tools-1.4.0-CVE-2014-9640.patch | 24 ++++++
15 .../vorbis-tools/vorbis-tools-1.4.0-r4.ebuild | 46 +++++++++++
16 3 files changed, 162 insertions(+)
17
18 diff --git a/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9638.patch b/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9638.patch
19 new file mode 100644
20 index 00000000000..79859df0274
21 --- /dev/null
22 +++ b/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9638.patch
23 @@ -0,0 +1,92 @@
24 +Patches taken as references:
25 +https://github.com/mark4o/opus-tools/commit/8c412e619b83eb6dd32191909cf6672e93e5802e
26 +https://trac.xiph.org/attachment/ticket/2212/0001-oggenc-Fix-large-alloca-on-bad-AIFF-input.patch
27 +To fix bug report:
28 +http://www.openwall.com/lists/oss-security/2015/08/29/1
29 + https://bugs.gentoo.org/show_bug.cgi?id=559170
30 +https://bugs.gentoo.org/show_bug.cgi?id=537422
31 +--- oggenc/audio.h
32 ++++ oggenc/audio.h
33 +@@ -25,7 +25,7 @@
34 +
35 + typedef struct {
36 + short format;
37 +- short channels;
38 ++ unsigned short channels;
39 + int samplerate;
40 + int bytespersec;
41 + short align;
42 +@@ -44,7 +44,7 @@
43 + } wavfile;
44 +
45 + typedef struct {
46 +- short channels;
47 ++ unsigned short channels;
48 + int totalframes;
49 + short samplesize;
50 + int rate;
51 +--- oggenc/audio.c
52 ++++ oggenc/audio.c
53 +@@ -245,8 +245,8 @@
54 + int aiff_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen)
55 + {
56 + int aifc; /* AIFC or AIFF? */
57 +- unsigned int len;
58 +- unsigned char *buffer;
59 ++ unsigned int len,readlen;
60 ++ unsigned char buffer[22];
61 + unsigned char buf2[8];
62 + aiff_fmt format;
63 + aifffile *aiff = malloc(sizeof(aifffile));
64 +@@ -269,9 +269,9 @@
65 + return 0; /* Weird common chunk */
66 + }
67 +
68 +- buffer = alloca(len);
69 +-
70 +- if(fread(buffer,1,len,in) < len)
71 ++ readlen = len < sizeof(buffer) ? len : sizeof(buffer);
72 ++ if(fread(buffer,1,readlen,in) < readlen ||
73 ++ (len > readlen && !seek_forward(in, len-readlen)))
74 + {
75 + fprintf(stderr, _("Warning: Unexpected EOF in reading AIFF header\n"));
76 + return 0;
77 +@@ -277,11 +277,18 @@
78 + return 0;
79 + }
80 +
81 +- format.channels = READ_U16_BE(buffer);
82 ++ format.channels = (short)READ_U16_BE(buffer);
83 + format.totalframes = READ_U32_BE(buffer+2);
84 + format.samplesize = READ_U16_BE(buffer+6);
85 + format.rate = (int)read_IEEE80(buffer+8);
86 +
87 ++ if(format.channels <=0)
88 ++ {
89 ++ fprintf(stderr, _("ERROR: Invalid channel count in AIFF header\n"));
90 ++ return 0;
91 ++
92 ++ }
93 ++
94 + aiff->bigendian = 1;
95 +
96 + if(aifc)
97 +@@ -449,11 +449,17 @@
98 + }
99 +
100 + format.format = READ_U16_LE(buf);
101 +- format.channels = READ_U16_LE(buf+2);
102 ++ format.channels = (short)READ_U16_LE(buf+2);
103 + format.samplerate = READ_U32_LE(buf+4);
104 + format.bytespersec = READ_U32_LE(buf+8);
105 + format.align = READ_U16_LE(buf+12);
106 + format.samplesize = READ_U16_LE(buf+14);
107 ++
108 ++ if(format.channels == 0)
109 ++ {
110 ++ fprintf(stderr, _("ERROR: Zero channels in WAV header\n"));
111 ++ return 0;
112 ++ }
113 +
114 + if(format.format == -2) /* WAVE_FORMAT_EXTENSIBLE */
115 + {
116
117 diff --git a/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9640.patch b/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9640.patch
118 new file mode 100644
119 index 00000000000..51c23b062af
120 --- /dev/null
121 +++ b/media-sound/vorbis-tools/files/vorbis-tools-1.4.0-CVE-2014-9640.patch
122 @@ -0,0 +1,24 @@
123 +Patch taken from:
124 +https://trac.xiph.org/changeset/19117
125 +To fix bug report:
126 +https://bugs.gentoo.org/show_bug.cgi?id=537422
127 +--- vorbis-tools-1.4.0/oggenc/oggenc.c
128 ++++ vorbis-tools-1.4.0/oggenc/oggenc.c
129 +@@ -97,6 +97,8 @@
130 + .3,-1,
131 + 0,0,0.f,
132 + 0, 0, 0, 0, 0};
133 ++ input_format raw_format = {NULL, 0, raw_open, wav_close, "raw",
134 ++ N_("RAW file reader")};
135 +
136 + int i;
137 +
138 +@@ -239,8 +241,6 @@
139 +
140 + if(opt.rawmode)
141 + {
142 +- input_format raw_format = {NULL, 0, raw_open, wav_close, "raw",
143 +- N_("RAW file reader")};
144 +
145 + enc_opts.rate=opt.raw_samplerate;
146 + enc_opts.channels=opt.raw_channels;
147
148 diff --git a/media-sound/vorbis-tools/vorbis-tools-1.4.0-r4.ebuild b/media-sound/vorbis-tools/vorbis-tools-1.4.0-r4.ebuild
149 new file mode 100644
150 index 00000000000..7f85f35db51
151 --- /dev/null
152 +++ b/media-sound/vorbis-tools/vorbis-tools-1.4.0-r4.ebuild
153 @@ -0,0 +1,46 @@
154 +# Copyright 1999-2017 Gentoo Foundation
155 +# Distributed under the terms of the GNU General Public License v2
156 +
157 +EAPI=5
158 +inherit autotools eutils
159 +
160 +DESCRIPTION="tools for using the Ogg Vorbis sound file format"
161 +HOMEPAGE="http://www.vorbis.com"
162 +SRC_URI="http://downloads.xiph.org/releases/vorbis/${P}.tar.gz"
163 +
164 +LICENSE="GPL-2"
165 +SLOT="0"
166 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris"
167 +IUSE="flac kate nls +ogg123 speex"
168 +
169 +RDEPEND=">=media-libs/libvorbis-1.3.0
170 + flac? ( media-libs/flac )
171 + kate? ( media-libs/libkate )
172 + ogg123? (
173 + >=media-libs/libao-1.0.0
174 + net-misc/curl
175 + )
176 + speex? ( media-libs/speex )"
177 +DEPEND="${RDEPEND}
178 + nls? ( sys-devel/gettext )
179 + virtual/pkgconfig"
180 +
181 +DOCS="AUTHORS CHANGES README"
182 +
183 +src_prepare() {
184 + epatch "${FILESDIR}"/${P}-underlinking.patch
185 + epatch "${FILESDIR}"/${P}-format-security.patch
186 + epatch "${FILESDIR}"/${P}-CVE-2014-9640.patch
187 + epatch "${FILESDIR}"/${P}-CVE-2014-9638.patch
188 + sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die #515220
189 + eautoreconf
190 +}
191 +
192 +src_configure() {
193 + econf \
194 + $(use_enable nls) \
195 + $(use_enable ogg123) \
196 + $(use_with flac) \
197 + $(use_with speex) \
198 + $(use_with kate)
199 +}