From 957235cf19a691360c720f7913672adda4258ed0 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 7 Oct 2018 11:03:14 +0100 Subject: gentoo resync : 07.10.2018 --- media-libs/libmad/Manifest | 2 + ...CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch | 197 +++++++++++++++++++++ media-libs/libmad/libmad-0.15.1b-r9.ebuild | 80 +++++++++ 3 files changed, 279 insertions(+) create mode 100644 media-libs/libmad/files/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch create mode 100644 media-libs/libmad/libmad-0.15.1b-r9.ebuild (limited to 'media-libs/libmad') diff --git a/media-libs/libmad/Manifest b/media-libs/libmad/Manifest index 2f6e05eb4c76..c96c35baa398 100644 --- a/media-libs/libmad/Manifest +++ b/media-libs/libmad/Manifest @@ -1,7 +1,9 @@ +AUX libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch 5122 BLAKE2B bbdfd8ff85028e9d802659c7cfe4b3ef4102de73a551d38b3185055d210596125687e427fecce1625e1cc1c24b69597e20de5b41dbf551a0cdb04e1cf89707f3 SHA512 86df28733ca0ad92e57244b46dc722ce844d92851039b6ff548515f20373e9e42888b815068e69134686f650a276ef7ff59601d6d193aea25e09c59ea051b63b AUX libmad-0.15.1b-cflags-O2.patch 347 BLAKE2B 65476b488c2dca48bf983da739240651e82f448b8e6546dfb68e2a2f29e953fcb6e6b1f498d1e805ccbf32cc8914f5b49c5135eb19388c8711989312a3692e7c SHA512 13a8bac30cea4861f903b4abc8673f9a35b6253aae6a02915f99b67e5e8c56460fc1fb059a0aa52143b665f888928baba098daf0ed022420e46317be4dbc6161 AUX libmad-0.15.1b-cflags.patch 4867 BLAKE2B adcfc2732f6b8b2310f50d234a695820d8fdd7f292de6621abfc23922cda512d26b1eb64dcb36751ea8cd34784189bcfe8be7cd46ed654f92370071df7598890 SHA512 01dc8421dba2b652aa8ca6d1f1a5c310645465b18190ebfdeaae516de881869957e8e7c0c373d0d09623da33719d01e028f2f6164790b54c43a71271f5b4dbba AUX libmad-0.15.1b-gcc44-mips-h-constraint-removal.patch 2377 BLAKE2B aff2507810157aec4062d157546b921a43cdf63a4e0684f5864ea71b36b4fa726f4ce33d558b7aaec8bb927876abe23c017ef3a1ba9b55715202887010cba3a3 SHA512 de08e0ce3c39b76c2838f940279a39c26e9c7e5b1e762c44f0db1ce3f65364e51036ad4f4ccdc160d80660c723a1bede70a4b505a9a01583de43ebc47aaeedb9 AUX mad.pc 211 BLAKE2B 3b8678e667461caa6ddc2479687d92a8bab9e7e05be73640e63c9eaf070fcd69d9e26dac1d5e753171795236f5a461c7f59ad46e899ea3227902b9773f9bcfc3 SHA512 ec0b14bd0c6236a216107b507b92c06e295352f1657ba5e45f37fff220a73e1454b262ac36fc715d698c4ffd210d348fca71cf0198e2c49d16fe0ec5ea839f08 DIST libmad-0.15.1b.tar.gz 502379 BLAKE2B b00de857a0634d7193f656b74cdd5c0642b674f3ee3303a642f8a6fcb64eebaf2b100c6e09d85d892880b5fc4f224c0a5d1ecf5bd95bc5caf00e959c7beac4a5 SHA512 2cad30347fb310dc605c46bacd9da117f447a5cabedd8fefdb24ab5de641429e5ec5ce8af7aefa6a75a3f545d3adfa255e3fa0a2d50971f76bc0c4fc0400cc45 EBUILD libmad-0.15.1b-r8.ebuild 2262 BLAKE2B 83fc39bdfc1c0b0da64c42f3e46c2a38d627415c37ee04a587e73b5e6cbbb12bde3209dae4132a8057eba9db16439e92c190b42f2708193638d188c7ff729ff2 SHA512 bbb6344c0e0c5d6644d14d09c3c4cfaa9b8837c37e27a16232cd0d10af8776e099ca90b79939a077c7a4f8e86f17171a17ce323240c7c65a507bccaa9537b052 +EBUILD libmad-0.15.1b-r9.ebuild 2213 BLAKE2B c588af11ea6b22a4ac5f5fbb18f85bfc3bdbbd2e7010945c0697823a9cf6c8d9da86b74fb71a5e2192d2b7a9a85934e6429cacd793515758c6f17885e24b9b35 SHA512 f32f57cca05a0abf2d4a237c05fe5178a21c32dc0d41ea14e295e8ebf6a02d5a4967880cf3e7e4964978592aed682d29adf9aeeb6aafcb9bf7d2f688ff58e079 MISC metadata.xml 326 BLAKE2B a9064ce28313804fb873d3e0b4fcb96681a2fcdcf60011d629268f73ab47f6c00ff6e0d95d2d075ec6af89bbe7aea4b6346ef2500815f08a69318a8736e7201d SHA512 b6c3a0765c5d00fd44caf7266edb75a373d8d4e813ac7f68507067f57713090fdc84f95886e73401d9c912f7f64453c975117030692526a49aebd6f5276751c9 diff --git a/media-libs/libmad/files/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch b/media-libs/libmad/files/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch new file mode 100644 index 000000000000..9cc8913e159c --- /dev/null +++ b/media-libs/libmad/files/libmad-0.15.1b-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch @@ -0,0 +1,197 @@ +; You can calculate where the next frame will start depending on things +; like the bitrate. See mad_header_decode(). It seems that when decoding +; the frame you can go past that boundary. This attempts to catch those cases, +; but might not catch all of them. +; For more info see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508133 +Index: libmad-0.15.1b/layer12.c +=================================================================== +--- a/layer12.c 2008-12-23 21:38:07.000000000 +0100 ++++ b/layer12.c 2008-12-23 21:38:12.000000000 +0100 +@@ -134,6 +134,12 @@ + for (sb = 0; sb < bound; ++sb) { + for (ch = 0; ch < nch; ++ch) { + nb = mad_bit_read(&stream->ptr, 4); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + if (nb == 15) { + stream->error = MAD_ERROR_BADBITALLOC; +@@ -146,6 +152,12 @@ + + for (sb = bound; sb < 32; ++sb) { + nb = mad_bit_read(&stream->ptr, 4); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + if (nb == 15) { + stream->error = MAD_ERROR_BADBITALLOC; +@@ -162,6 +174,12 @@ + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) { + scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + # if defined(OPT_STRICT) + /* +@@ -187,6 +205,12 @@ + frame->sbsample[ch][s][sb] = nb ? + mad_f_mul(I_sample(&stream->ptr, nb), + sf_table[scalefactor[ch][sb]]) : 0; ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + } + } + +@@ -195,6 +219,12 @@ + mad_fixed_t sample; + + sample = I_sample(&stream->ptr, nb); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + for (ch = 0; ch < nch; ++ch) { + frame->sbsample[ch][s][sb] = +@@ -403,7 +433,15 @@ + nbal = bitalloc_table[offsets[sb]].nbal; + + for (ch = 0; ch < nch; ++ch) ++ { + allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } ++ } + } + + for (sb = bound; sb < sblimit; ++sb) { +@@ -411,6 +449,13 @@ + + allocation[0][sb] = + allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); ++ ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + } + + /* decode scalefactor selection info */ +@@ -419,6 +464,12 @@ + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) + scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + } + } + +@@ -442,6 +493,12 @@ + for (ch = 0; ch < nch; ++ch) { + if (allocation[ch][sb]) { + scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + switch (scfsi[ch][sb]) { + case 2: +@@ -452,11 +509,23 @@ + + case 0: + scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + /* fall through */ + + case 1: + case 3: + scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + } + + if (scfsi[ch][sb] & 1) +@@ -488,6 +557,12 @@ + index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; + + II_samples(&stream->ptr, &qc_table[index], samples); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + for (s = 0; s < 3; ++s) { + frame->sbsample[ch][3 * gr + s][sb] = +@@ -506,6 +581,12 @@ + index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; + + II_samples(&stream->ptr, &qc_table[index], samples); ++ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + for (ch = 0; ch < nch; ++ch) { + for (s = 0; s < 3; ++s) { +Index: libmad-0.15.1b/layer3.c +=================================================================== +--- a/layer3.c 2008-12-23 21:38:07.000000000 +0100 ++++ b/layer3.c 2008-12-23 21:38:12.000000000 +0100 +@@ -2608,6 +2608,12 @@ + next_md_begin = 0; + + md_len = si.main_data_begin + frame_space - next_md_begin; ++ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) ++ { ++ stream->error = MAD_ERROR_LOSTSYNC; ++ stream->sync = 0; ++ return -1; ++ } + + frame_used = 0; + diff --git a/media-libs/libmad/libmad-0.15.1b-r9.ebuild b/media-libs/libmad/libmad-0.15.1b-r9.ebuild new file mode 100644 index 000000000000..42745664ae16 --- /dev/null +++ b/media-libs/libmad/libmad-0.15.1b-r9.ebuild @@ -0,0 +1,80 @@ +# Copyright 1999-2018 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools flag-o-matic multilib-minimal + +DESCRIPTION="\"M\"peg \"A\"udio \"D\"ecoder library" +HOMEPAGE="http://mad.sourceforge.net" +SRC_URI="mirror://sourceforge/mad/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ia64 ~mips ppc ppc64 ~sh ~sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris" +IUSE="debug static-libs" + +DEPEND="" +RDEPEND="" + +DOCS=( CHANGES CREDITS README TODO VERSION ) + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/mad.h +) + +PATCHES=( + "${FILESDIR}"/${P}-cflags.patch + "${FILESDIR}"/${P}-cflags-O2.patch + "${FILESDIR}"/${P}-gcc44-mips-h-constraint-removal.patch + "${FILESDIR}"/${P}-CVE-2017-8372_CVE-2017-8373_CVE-2017-8374.patch +) + +src_prepare() { + default + + # bug 467002 + sed -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' -i configure.ac || die + + eautoreconf +} + +multilib_src_configure() { + # --enable-speed optimize for speed over accuracy + # --enable-accuracy optimize for accuracy over speed + # --enable-experimental enable code using the EXPERIMENTAL + # preprocessor define + local myconf=( + --enable-accuracy + $(use_enable debug debugging) + $(use_enable static-libs static) + ) + + # Fix for b0rked sound on sparc64 (maybe also sparc32?) + # default/approx is also possible, uses less cpu but sounds worse + use sparc && myconf+=( --enable-fpm=64bit ) + + [[ $(tc-arch) == "amd64" ]] && myconf+=( --enable-fpm=64bit ) + [[ $(tc-arch) == "x86" ]] && myconf+=( --enable-fpm=intel ) + [[ $(tc-arch) == "ppc" ]] && myconf+=( --enable-fpm=default ) + [[ $(tc-arch) == "ppc64" ]] && myconf+=( --enable-fpm=64bit ) + + ECONF_SOURCE="${S}" econf "${myconf[@]}" +} + +multilib_src_install() { + emake DESTDIR="${D}" install + + # This file must be updated with each version update + insinto /usr/$(get_libdir)/pkgconfig + doins "${FILESDIR}"/mad.pc + + # Use correct libdir in pkgconfig file + sed -e "s:^libdir.*:libdir=${EPREFIX}/usr/$(get_libdir):" \ + -i "${ED}"/usr/$(get_libdir)/pkgconfig/mad.pc +} + +multilib_src_install_all() { + einstalldocs + find "${D}" -name '*.la' -delete || die +} -- cgit v1.2.3