From 3cf7c3ef441822c889356fd1812ebf2944a59851 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 25 Aug 2020 10:45:55 +0100 Subject: gentoo resync : 25.08.2020 --- media-libs/audiofile/Manifest | 5 +- media-libs/audiofile/audiofile-0.3.6-r3.ebuild | 50 --- media-libs/audiofile/audiofile-0.3.6-r4.ebuild | 55 +++ .../files/audiofile-0.3.6-CVE-2017-68xx.patch | 379 +++++++++++++++++++++ ...ofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch | 82 +++++ .../files/audiofile-0.3.6-system-gtest.patch | 141 -------- 6 files changed, 519 insertions(+), 193 deletions(-) delete mode 100644 media-libs/audiofile/audiofile-0.3.6-r3.ebuild create mode 100644 media-libs/audiofile/audiofile-0.3.6-r4.ebuild create mode 100644 media-libs/audiofile/files/audiofile-0.3.6-CVE-2017-68xx.patch create mode 100644 media-libs/audiofile/files/audiofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch delete mode 100644 media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch (limited to 'media-libs/audiofile') diff --git a/media-libs/audiofile/Manifest b/media-libs/audiofile/Manifest index debb236f7eb9..9a5fb34ec2ea 100644 --- a/media-libs/audiofile/Manifest +++ b/media-libs/audiofile/Manifest @@ -1,7 +1,8 @@ AUX audiofile-0.3.6-CVE-2015-7747.patch 4286 BLAKE2B 407ed02b63a8164324bbf2bcecc3533b711ebc3ffd44896f26a286496d01490b35efe8a4ea9b00eed69a484deb2516157bb23de94eb00e19f79cb8782f5ba33b SHA512 5def88fec10355224716783c84933c2b3adfc7608635b8d352c0728bf0e7765d146addaecf13a4f650a95f6aeb8f528ee1e8cfa785c1cdae3f6d75552e46faba +AUX audiofile-0.3.6-CVE-2017-68xx.patch 12634 BLAKE2B d66ef71b5ce0d8b7356c856eb9496443918892c638213b836dbf83f79e5689e4e8b66533eeb65ad0e9b4668a745ae0a2b89a6f627a90311671e349a5ebc3aee8 SHA512 11259f5cf2de2b13836696cd045e78ad4a2a0c4ecf24d59152b99f01fdead97b1b7877728868538355440f4460e9b0f8a9399fe4ac348de658cbc2fb9f5ace52 +AUX audiofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch 2702 BLAKE2B f56d2bd5651193984e00904ff916c4d1658d49da4db531d8cfa43b936857dc4ed142e83114890dc59f1c7a1b8d5cdf07127465ec9851323e50c37bd6045a7c07 SHA512 0fc8252ddab1430e960551093de1f4d5dc281440b0a583dde8ecf7ef3e6bad78667c049957cac24a2ff8731a22090d998406a6e4e84d80a9e2d5580663cd1f67 AUX audiofile-0.3.6-gcc6-build-fixes.patch 3785 BLAKE2B 7f016bfa9af8a440e31bcc395c654c9bb25a1d914a6b57bc191ad36e55ca191f924d57d48834a05ea30913ddd744056e244654a96529b1c3632ef5b162252c76 SHA512 60837bcc9aa53d546708210e87a4f24db56c8a4b0c6896c8e39e0d213aafa15f59a65a60726e6abbf16681fc1fa6ca59cf1748a63caf5ff2652d55f10f62a976 AUX audiofile-0.3.6-mingw32.patch 687 BLAKE2B dec0680a401890f64a659a7303b089d03a40001d2b73da66c174663f818e5e72b7b8985e8fa220c15685b4cd857ba24cefb341c95059a4d9e10ae81a580a8f50 SHA512 b568b189f7316a41c724b02ee881adcdcb0e01fe22d4d6adc82fefef3296c34822943ec1cb299169dfd8fcdac9c260e1dd69fc9b5b6b4058382cc2f246c382f8 -AUX audiofile-0.3.6-system-gtest.patch 5209 BLAKE2B fa4a40165b37a6d33b929efbd79e20a1a7b953ee6d826dfbe88907255f217dcad1f9f4b14b910abe0d60a5c6b3956c92b3a7d6df76d1a47b7e5853bd7bc1d3a9 SHA512 ae821f7e4ea1684651e430007b2b52b369769d8b60cc7180aee3c80c55c7d01ad9e97792099d2d6694eec2f090552355688e2ee3cc527d7a8989e717d3de5b5d DIST audiofile-0.3.6.tar.xz 530760 BLAKE2B 5263e66b92471c8b7e8ad73a5065966fc93fd92d70481df804451353bafe44d670ec48b183bc19a7ac60025ea73b234d6aef1017fb220c16d14c68a27db027e4 SHA512 f3b58210a4ef3ac8e08a368a78e0f4b8345456d084bdebfd20d1631fa75e562aa58d31863a502b6ff18178327aa5b87403566bd34566fa52bdfc8e01de400bcb -EBUILD audiofile-0.3.6-r3.ebuild 1259 BLAKE2B e64cdd7527b1e723884068f5cbc80b45977250910ba208b37e41142202bd04f57bbd9dc331c36cc587d577bf6c17c8ce6cb1663d956926010971d307c050ea97 SHA512 7e0bb29365a0f361f3c05ecea52fc720f41b15ce1aba6f4b5551d3013ed8516b5489865b1638a3ee86d319676c048f7fd5db1f176287329119a31b23e691e9ee +EBUILD audiofile-0.3.6-r4.ebuild 1409 BLAKE2B 25674b0fd7d69d3fe1d44cc698d36218279156060941bdb580c59e41a08eed2a64501cc4735144a1b4649a8a06af089690c519ec97242474d312d1aa18e7c53e SHA512 6aa3b80fb36556a4ddf44415cd4d51efb5e9df639e9d140484b41a4599a9ee4309a1c763ba988e8dc96cdb0ffb87e79349d2c425b84f30fbfe86db89bd6d37b6 MISC metadata.xml 359 BLAKE2B 3a6913b1f6e97d45f7d1c415879d82fec86642dc2a187907d1893ff9b81cf7781a5485e5140a901482913713ab4f7a5a8ce62df872fc75bf2f34f80d0dbeef9c SHA512 2f2ae33ca88cb3246c8419b88a800ba405123263a6cf2f94c9478d8303bf036ece9a6781a1fe83d8b1f329071623e76f6e909c0207289d6dad8166b163c3b897 diff --git a/media-libs/audiofile/audiofile-0.3.6-r3.ebuild b/media-libs/audiofile/audiofile-0.3.6-r3.ebuild deleted file mode 100644 index 5742a016cb12..000000000000 --- a/media-libs/audiofile/audiofile-0.3.6-r3.ebuild +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -inherit autotools gnome.org multilib-minimal - -DESCRIPTION="An elegant API for accessing audio files" -HOMEPAGE="http://www.68k.org/~michael/audiofile/" - -LICENSE="GPL-2 LGPL-2.1" -SLOT="0/1" # subslot = soname major version -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris" -IUSE="flac static-libs test" -RESTRICT="!test? ( test )" - -RDEPEND="flac? ( >=media-libs/flac-1.2.1[${MULTILIB_USEDEP}] )" -DEPEND="${RDEPEND} - virtual/pkgconfig - test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )" - -PATCHES=( - "${FILESDIR}"/${PN}-0.3.6-gcc6-build-fixes.patch - "${FILESDIR}"/${PN}-0.3.6-system-gtest.patch - "${FILESDIR}"/${PN}-0.3.6-CVE-2015-7747.patch - "${FILESDIR}"/${PN}-0.3.6-mingw32.patch -) - -src_prepare() { - default - eautoreconf -} - -multilib_src_configure() { - local myconf=( - --enable-largefile - --disable-werror - --disable-examples - $(use_enable flac) - $(use_enable static-libs static) - ) - ECONF_SOURCE="${S}" econf "${myconf[@]}" -} - -multilib_src_install_all() { - einstalldocs - - # package provides .pc file - find "${ED}" -name '*.la' -delete || die -} diff --git a/media-libs/audiofile/audiofile-0.3.6-r4.ebuild b/media-libs/audiofile/audiofile-0.3.6-r4.ebuild new file mode 100644 index 000000000000..99fb3b6f6e83 --- /dev/null +++ b/media-libs/audiofile/audiofile-0.3.6-r4.ebuild @@ -0,0 +1,55 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit autotools gnome.org multilib-minimal + +DESCRIPTION="An elegant API for accessing audio files" +HOMEPAGE="http://www.68k.org/~michael/audiofile/" + +LICENSE="GPL-2 LGPL-2.1" +SLOT="0/1" # subslot = soname major version +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris" +IUSE="flac" + +RDEPEND="flac? ( >=media-libs/flac-1.2.1[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/${PN}-0.3.6-gcc6-build-fixes.patch + "${FILESDIR}"/${PN}-0.3.6-CVE-2015-7747.patch + "${FILESDIR}"/${PN}-0.3.6-mingw32.patch + "${FILESDIR}"/${PN}-0.3.6-CVE-2017-68xx.patch + "${FILESDIR}"/${PN}-0.3.6-CVE-2018-13440-CVE-2018-17095.patch +) + +src_prepare() { + default + eautoreconf +} + +multilib_src_configure() { + # Tests depend on statically compiled binaries to work, so we'll have to + # delete them later rather than not compile them at all + local myconf=( + --enable-largefile + --disable-werror + --disable-examples + $(use_enable flac) + ) + ECONF_SOURCE="${S}" econf "${myconf[@]}" +} + +multilib_src_test() { + emake check +} + +multilib_src_install_all() { + einstalldocs + + # package provides .pc file + find "${ED}" -name '*.la' -delete || die + find "${ED}" -name '*.a' -delete || die +} diff --git a/media-libs/audiofile/files/audiofile-0.3.6-CVE-2017-68xx.patch b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2017-68xx.patch new file mode 100644 index 000000000000..99473d7e22ed --- /dev/null +++ b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2017-68xx.patch @@ -0,0 +1,379 @@ +Debian patchset for CVE-2017-68{29..38} and two other vulnerabilities: + +https://salsa.debian.org/multimedia-team/audiofile/commit/242f019#a064ca928f514268d4bae308e2e3990138341b76: + +* Address several vulnerabilities (Closes: #857651) + - Always check the number of coefficients (CVE-2017-6827 CVE-2017-6828 + CVE-2017-6832 CVE-2017-6833 CVE-2017-6835 CVE-2017-6837) + - clamp index values to fix index overflow in IMA.cpp (CVE-2017-6829) + - Check for multiplication overflow in sfconvert (CVE-2017-6830 + CVE-2017-6834 CVE-2017-6836 CVE-2017-6838) + - Actually fail when error occurs in parseFormat (CVE-2017-6831) + - Check for multiplication overflow in MSADPCM decodeSample + (CVE-2017-6839) +* Fix signature of multiplyCheckOverflow. It returns a bool, not an int +* Check for division by zero in BlockCodec::runPull + + +From a2e9eab8ea87c4ffc494d839ebb4ea145eb9f2e6 Mon Sep 17 00:00:00 2001 +From: Antonio Larrosa +Date: Mon, 6 Mar 2017 18:59:26 +0100 +Subject: [PATCH] Actually fail when error occurs in parseFormat + +When there's an unsupported number of bits per sample or an invalid +number of samples per block, don't only print an error message using +the error handler, but actually stop parsing the file. + +This fixes #35 (also reported at +https://bugzilla.opensuse.org/show_bug.cgi?id=1026983 and +https://blogs.gentoo.org/ago/2017/02/20/audiofile-heap-based-buffer-overflow-in-imadecodeblockwave-ima-cpp/ +) +--- + libaudiofile/WAVE.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp +index 0e81cf7..d762249 100644 +--- a/libaudiofile/WAVE.cpp ++++ b/libaudiofile/WAVE.cpp +@@ -326,6 +326,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size) + { + _af_error(AF_BAD_NOT_IMPLEMENTED, + "IMA ADPCM compression supports only 4 bits per sample"); ++ return AF_FAIL; + } + + int bytesPerBlock = (samplesPerBlock + 14) / 8 * 4 * channelCount; +@@ -333,6 +334,7 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size) + { + _af_error(AF_BAD_CODEC_CONFIG, + "Invalid samples per block for IMA ADPCM compression"); ++ return AF_FAIL; + } + + track->f.sampleWidth = 16; +-- +2.11.0 + +From c48e4c6503f7dabd41f11d4c9c7b7f8960e7f2c0 Mon Sep 17 00:00:00 2001 +From: Antonio Larrosa +Date: Mon, 6 Mar 2017 12:51:22 +0100 +Subject: [PATCH] Always check the number of coefficients + +When building the library with NDEBUG, asserts are eliminated +so it's better to always check that the number of coefficients +is inside the array range. + +This fixes the 00191-audiofile-indexoob issue in #41 +--- + libaudiofile/WAVE.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/libaudiofile/WAVE.cpp b/libaudiofile/WAVE.cpp +index 0e81cf7..61f9541 100644 +--- a/libaudiofile/WAVE.cpp ++++ b/libaudiofile/WAVE.cpp +@@ -281,6 +281,12 @@ status WAVEFile::parseFormat(const Tag &id, uint32_t size) + + /* numCoefficients should be at least 7. */ + assert(numCoefficients >= 7 && numCoefficients <= 255); ++ if (numCoefficients < 7 || numCoefficients > 255) ++ { ++ _af_error(AF_BAD_HEADER, ++ "Bad number of coefficients"); ++ return AF_FAIL; ++ } + + m_msadpcmNumCoefficients = numCoefficients; + +-- +2.11.0 + +From: Antonio Larrosa +Date: Thu, 9 Mar 2017 10:21:18 +0100 +Subject: Check for division by zero in BlockCodec::runPull + +--- + libaudiofile/modules/BlockCodec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp +index 4731be1..eb2fb4d 100644 +--- a/libaudiofile/modules/BlockCodec.cpp ++++ b/libaudiofile/modules/BlockCodec.cpp +@@ -47,7 +47,7 @@ void BlockCodec::runPull() + + // Read the compressed data. + ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount); +- int blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0; ++ int blocksRead = (bytesRead >= 0 && m_bytesPerPacket > 0) ? bytesRead / m_bytesPerPacket : 0; + + // Decompress into m_outChunk. + for (int i=0; i +Date: Mon, 6 Mar 2017 13:43:53 +0100 +Subject: [PATCH] Check for multiplication overflow in MSADPCM decodeSample + +Check for multiplication overflow (using __builtin_mul_overflow +if available) in MSADPCM.cpp decodeSample and return an empty +decoded block if an error occurs. + +This fixes the 00193-audiofile-signintoverflow-MSADPCM case of #41 +--- + libaudiofile/modules/BlockCodec.cpp | 5 ++-- + libaudiofile/modules/MSADPCM.cpp | 47 +++++++++++++++++++++++++++++++++---- + 2 files changed, 46 insertions(+), 6 deletions(-) + +diff --git a/libaudiofile/modules/BlockCodec.cpp b/libaudiofile/modules/BlockCodec.cpp +index 45925e8..4731be1 100644 +--- a/libaudiofile/modules/BlockCodec.cpp ++++ b/libaudiofile/modules/BlockCodec.cpp +@@ -52,8 +52,9 @@ void BlockCodec::runPull() + // Decompress into m_outChunk. + for (int i=0; i(m_inChunk->buffer) + i * m_bytesPerPacket, +- static_cast(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount); ++ if (decodeBlock(static_cast(m_inChunk->buffer) + i * m_bytesPerPacket, ++ static_cast(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount)==0) ++ break; + + framesRead += m_framesPerPacket; + } +diff --git a/libaudiofile/modules/MSADPCM.cpp b/libaudiofile/modules/MSADPCM.cpp +index 8ea3c85..ef9c38c 100644 +--- a/libaudiofile/modules/MSADPCM.cpp ++++ b/libaudiofile/modules/MSADPCM.cpp +@@ -101,24 +101,60 @@ static const int16_t adaptationTable[] = + 768, 614, 512, 409, 307, 230, 230, 230 + }; + ++int firstBitSet(int x) ++{ ++ int position=0; ++ while (x!=0) ++ { ++ x>>=1; ++ ++position; ++ } ++ return position; ++} ++ ++#ifndef __has_builtin ++#define __has_builtin(x) 0 ++#endif ++ ++int multiplyCheckOverflow(int a, int b, int *result) ++{ ++#if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow)) ++ return __builtin_mul_overflow(a, b, result); ++#else ++ if (firstBitSet(a)+firstBitSet(b)>31) // int is signed, so we can't use 32 bits ++ return true; ++ *result = a * b; ++ return false; ++#endif ++} ++ ++ + // Compute a linear PCM value from the given differential coded value. + static int16_t decodeSample(ms_adpcm_state &state, +- uint8_t code, const int16_t *coefficient) ++ uint8_t code, const int16_t *coefficient, bool *ok=NULL) + { + int linearSample = (state.sample1 * coefficient[0] + + state.sample2 * coefficient[1]) >> 8; ++ int delta; + + linearSample += ((code & 0x08) ? (code - 0x10) : code) * state.delta; + + linearSample = clamp(linearSample, MIN_INT16, MAX_INT16); + +- int delta = (state.delta * adaptationTable[code]) >> 8; ++ if (multiplyCheckOverflow(state.delta, adaptationTable[code], &delta)) ++ { ++ if (ok) *ok=false; ++ _af_error(AF_BAD_COMPRESSION, "Error decoding sample"); ++ return 0; ++ } ++ delta >>= 8; + if (delta < 16) + delta = 16; + + state.delta = delta; + state.sample2 = state.sample1; + state.sample1 = linearSample; ++ if (ok) *ok=true; + + return static_cast(linearSample); + } +@@ -212,13 +248,16 @@ int MSADPCM::decodeBlock(const uint8_t *encoded, int16_t *decoded) + { + uint8_t code; + int16_t newSample; ++ bool ok; + + code = *encoded >> 4; +- newSample = decodeSample(*state[0], code, coefficient[0]); ++ newSample = decodeSample(*state[0], code, coefficient[0], &ok); ++ if (!ok) return 0; + *decoded++ = newSample; + + code = *encoded & 0x0f; +- newSample = decodeSample(*state[1], code, coefficient[1]); ++ newSample = decodeSample(*state[1], code, coefficient[1], &ok); ++ if (!ok) return 0; + *decoded++ = newSample; + + encoded++; +-- +2.11.0 + +From 7d65f89defb092b63bcbc5d98349fb222ca73b3c Mon Sep 17 00:00:00 2001 +From: Antonio Larrosa +Date: Mon, 6 Mar 2017 13:54:52 +0100 +Subject: [PATCH] Check for multiplication overflow in sfconvert + +Checks that a multiplication doesn't overflow when +calculating the buffer size, and if it overflows, +reduce the buffer size instead of failing. + +This fixes the 00192-audiofile-signintoverflow-sfconvert case +in #41 +--- + sfcommands/sfconvert.c | 34 ++++++++++++++++++++++++++++++++-- + 1 file changed, 32 insertions(+), 2 deletions(-) + +diff --git a/sfcommands/sfconvert.c b/sfcommands/sfconvert.c +index 80a1bc4..970a3e4 100644 +--- a/sfcommands/sfconvert.c ++++ b/sfcommands/sfconvert.c +@@ -45,6 +45,33 @@ void printusage (void); + void usageerror (void); + bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid); + ++int firstBitSet(int x) ++{ ++ int position=0; ++ while (x!=0) ++ { ++ x>>=1; ++ ++position; ++ } ++ return position; ++} ++ ++#ifndef __has_builtin ++#define __has_builtin(x) 0 ++#endif ++ ++int multiplyCheckOverflow(int a, int b, int *result) ++{ ++#if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow)) ++ return __builtin_mul_overflow(a, b, result); ++#else ++ if (firstBitSet(a)+firstBitSet(b)>31) // int is signed, so we can't use 32 bits ++ return true; ++ *result = a * b; ++ return false; ++#endif ++} ++ + int main (int argc, char **argv) + { + if (argc == 2) +@@ -323,8 +350,11 @@ bool copyaudiodata (AFfilehandle infile, AFfilehandle outfile, int trackid) + { + int frameSize = afGetVirtualFrameSize(infile, trackid, 1); + +- const int kBufferFrameCount = 65536; +- void *buffer = malloc(kBufferFrameCount * frameSize); ++ int kBufferFrameCount = 65536; ++ int bufferSize; ++ while (multiplyCheckOverflow(kBufferFrameCount, frameSize, &bufferSize)) ++ kBufferFrameCount /= 2; ++ void *buffer = malloc(bufferSize); + + AFframecount totalFrames = afGetFrameCount(infile, AF_DEFAULT_TRACK); + AFframecount totalFramesWritten = 0; +-- +2.11.0 + +From 25eb00ce913452c2e614548d7df93070bf0d066f Mon Sep 17 00:00:00 2001 +From: Antonio Larrosa +Date: Mon, 6 Mar 2017 18:02:31 +0100 +Subject: [PATCH] clamp index values to fix index overflow in IMA.cpp + +This fixes #33 +(also reported at https://bugzilla.opensuse.org/show_bug.cgi?id=1026981 +and https://blogs.gentoo.org/ago/2017/02/20/audiofile-global-buffer-overflow-in-decodesample-ima-cpp/) +--- + libaudiofile/modules/IMA.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libaudiofile/modules/IMA.cpp b/libaudiofile/modules/IMA.cpp +index 7476d44..df4aad6 100644 +--- a/libaudiofile/modules/IMA.cpp ++++ b/libaudiofile/modules/IMA.cpp +@@ -169,7 +169,7 @@ int IMA::decodeBlockWAVE(const uint8_t *encoded, int16_t *decoded) + if (encoded[1] & 0x80) + m_adpcmState[c].previousValue -= 0x10000; + +- m_adpcmState[c].index = encoded[2]; ++ m_adpcmState[c].index = clamp(encoded[2], 0, 88); + + *decoded++ = m_adpcmState[c].previousValue; + +@@ -210,7 +210,7 @@ int IMA::decodeBlockQT(const uint8_t *encoded, int16_t *decoded) + predictor -= 0x10000; + + state.previousValue = clamp(predictor, MIN_INT16, MAX_INT16); +- state.index = encoded[1] & 0x7f; ++ state.index = clamp(encoded[1] & 0x7f, 0, 88); + encoded += 2; + + for (int n=0; n +Date: Fri, 10 Mar 2017 15:40:02 +0100 +Subject: [PATCH] Fix signature of multiplyCheckOverflow. It returns a bool, + not an int + +--- + libaudiofile/modules/MSADPCM.cpp | 2 +- + sfcommands/sfconvert.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libaudiofile/modules/MSADPCM.cpp b/libaudiofile/modules/MSADPCM.cpp +index ef9c38c..d8c9553 100644 +--- a/libaudiofile/modules/MSADPCM.cpp ++++ b/libaudiofile/modules/MSADPCM.cpp +@@ -116,7 +116,7 @@ int firstBitSet(int x) + #define __has_builtin(x) 0 + #endif + +-int multiplyCheckOverflow(int a, int b, int *result) ++bool multiplyCheckOverflow(int a, int b, int *result) + { + #if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow)) + return __builtin_mul_overflow(a, b, result); +diff --git a/sfcommands/sfconvert.c b/sfcommands/sfconvert.c +index 970a3e4..367f7a5 100644 +--- a/sfcommands/sfconvert.c ++++ b/sfcommands/sfconvert.c +@@ -60,7 +60,7 @@ int firstBitSet(int x) + #define __has_builtin(x) 0 + #endif + +-int multiplyCheckOverflow(int a, int b, int *result) ++bool multiplyCheckOverflow(int a, int b, int *result) + { + #if (defined __GNUC__ && __GNUC__ >= 5) || ( __clang__ && __has_builtin(__builtin_mul_overflow)) + return __builtin_mul_overflow(a, b, result); +-- +2.11.0 + diff --git a/media-libs/audiofile/files/audiofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch new file mode 100644 index 000000000000..0d356fb072a2 --- /dev/null +++ b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2018-13440-CVE-2018-17095.patch @@ -0,0 +1,82 @@ +Fixes for CVE-2018-13440 and CVE-2018-17095 from here: +https://github.com/mpruett/audiofile/pull/52 + +These are the same used in Fedora. + +From fde6d79fb8363c4a329a184ef0b107156602b225 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 27 Sep 2018 10:48:45 +0200 +Subject: [PATCH 1/3] ModuleState: handle compress/decompress init failure + +When the unit initcompress or initdecompress function fails, +m_fileModule is NULL. Return AF_FAIL in that case instead of +causing NULL pointer dereferences later. + +Fixes #49 +--- + libaudiofile/modules/ModuleState.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libaudiofile/modules/ModuleState.cpp b/libaudiofile/modules/ModuleState.cpp +index 0c29d7a..070fd9b 100644 +--- a/libaudiofile/modules/ModuleState.cpp ++++ b/libaudiofile/modules/ModuleState.cpp +@@ -75,6 +75,9 @@ status ModuleState::initFileModule(AFfilehandle file, Track *track) + m_fileModule = unit->initcompress(track, file->m_fh, file->m_seekok, + file->m_fileFormat == AF_FILE_RAWDATA, &chunkFrames); + ++ if (!m_fileModule) ++ return AF_FAIL; ++ + if (unit->needsRebuffer) + { + assert(unit->nativeSampleFormat == AF_SAMPFMT_TWOSCOMP); + +From 941774c8c0e79007196d7f1e7afdc97689f869b3 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 27 Sep 2018 12:09:45 +0200 +Subject: [PATCH 2/3] ALAC: set chunk frameCount to 0 on short read + +--- + libaudiofile/modules/ALAC.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libaudiofile/modules/ALAC.cpp b/libaudiofile/modules/ALAC.cpp +index 7593c11..478e2af 100644 +--- a/libaudiofile/modules/ALAC.cpp ++++ b/libaudiofile/modules/ALAC.cpp +@@ -240,6 +240,7 @@ void ALAC::runPull() + if (read(m_inChunk->buffer, bytesPerPacket) < bytesPerPacket) + { + reportReadError(0, m_track->f.framesPerPacket); ++ m_outChunk->frameCount = 0; + return; + } + + +From 822b732fd31ffcb78f6920001e9b1fbd815fa712 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Thu, 27 Sep 2018 12:11:12 +0200 +Subject: [PATCH 3/3] SimpleModule: set output chunk framecount after pull + +After pulling the data, set the output chunk to the amount of +frames we pulled so that the next module in the chain has the correct +frame count. + +Fixes #50 and #51 +--- + libaudiofile/modules/SimpleModule.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libaudiofile/modules/SimpleModule.cpp b/libaudiofile/modules/SimpleModule.cpp +index 2bae1eb..e87932c 100644 +--- a/libaudiofile/modules/SimpleModule.cpp ++++ b/libaudiofile/modules/SimpleModule.cpp +@@ -26,6 +26,7 @@ + void SimpleModule::runPull() + { + pull(m_outChunk->frameCount); ++ m_outChunk->frameCount = m_inChunk->frameCount; + run(*m_inChunk, *m_outChunk); + } + diff --git a/media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch b/media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch deleted file mode 100644 index f2421bdfcac3..000000000000 --- a/media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch +++ /dev/null @@ -1,141 +0,0 @@ ---- audiofile-0.3.6/configure.ac -+++ audiofile-0.3.6/configure.ac -@@ -160,7 +160,6 @@ - audiofile-uninstalled.pc - sfcommands/Makefile - test/Makefile -- gtest/Makefile - examples/Makefile - libaudiofile/Makefile - libaudiofile/alac/Makefile ---- audiofile-0.3.6/libaudiofile/Makefile.am -+++ audiofile-0.3.6/libaudiofile/Makefile.am -@@ -108,10 +108,9 @@ - TESTS_ENVIRONMENT = $(top_builddir)/libtool --mode=execute $(VALGRIND) $(VALGRIND_FLAGS) - endif - --LIBGTEST = ../gtest/libgtest.la - --UnitTests_SOURCES = modules/UT_RebufferModule.cpp --UnitTests_LDADD = libaudiofile.la $(LIBGTEST) -+UnitTests_SOURCES = modules/UT_RebufferModule.cpp $(libaudiofile_la_SOURCES) -+UnitTests_LDADD = $(libaudiofile_la_LIBADD) -lgtest - UnitTests_CPPFLAGS = -I$(top_srcdir) - UnitTests_CXXFLAGS = -fno-rtti -fno-exceptions -DGTEST_HAS_RTTI=0 -DGTEST_HAS_EXCEPTIONS=0 - UnitTests_LDFLAGS = -static ---- audiofile-0.3.6/Makefile.am -+++ audiofile-0.3.6/Makefile.am -@@ -1,6 +1,6 @@ - ## Process this file with automake to produce Makefile.in - --SUBDIRS = gtest libaudiofile sfcommands test examples docs -+SUBDIRS = libaudiofile sfcommands test examples docs - - EXTRA_DIST = \ - ACKNOWLEDGEMENTS \ ---- audiofile-0.3.6/test/Makefile.am -+++ audiofile-0.3.6/test/Makefile.am -@@ -59,79 +59,77 @@ - - DEPENDENCIES = $(LIBAUDIOFILE) - --LIBGTEST = ../gtest/libgtest.la -- - ADPCM_SOURCES = ADPCM.cpp TestUtilities.cpp TestUtilities.h --ADPCM_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+ADPCM_LDADD = -lgtest $(LIBAUDIOFILE) - - AES_SOURCES = AES.cpp TestUtilities.cpp TestUtilities.h --AES_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+AES_LDADD = -lgtest $(LIBAUDIOFILE) - - ALAC_SOURCES = ALAC.cpp Lossless.h TestUtilities.cpp TestUtilities.h --ALAC_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+ALAC_LDADD = -lgtest $(LIBAUDIOFILE) - - ChannelMatrix_SOURCES = ChannelMatrix.cpp TestUtilities.cpp TestUtilities.h --ChannelMatrix_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+ChannelMatrix_LDADD = -lgtest $(LIBAUDIOFILE) - - Error_SOURCES = Error.cpp TestUtilities.cpp TestUtilities.h --Error_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Error_LDADD = -lgtest $(LIBAUDIOFILE) - - FLAC_SOURCES = FLAC.cpp Lossless.h TestUtilities.cpp TestUtilities.h --FLAC_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+FLAC_LDADD = -lgtest $(LIBAUDIOFILE) - - FloatToInt_SOURCES = FloatToInt.cpp TestUtilities.cpp TestUtilities.h --FloatToInt_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+FloatToInt_LDADD = -lgtest $(LIBAUDIOFILE) - - Instrument_SOURCES = Instrument.cpp TestUtilities.cpp TestUtilities.h --Instrument_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Instrument_LDADD = -lgtest $(LIBAUDIOFILE) - - IntToFloat_SOURCES = IntToFloat.cpp TestUtilities.cpp TestUtilities.h --IntToFloat_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+IntToFloat_LDADD = -lgtest $(LIBAUDIOFILE) - - InvalidCompressionFormat_SOURCES = InvalidCompressionFormat.cpp TestUtilities.cpp TestUtilities.h --InvalidCompressionFormat_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+InvalidCompressionFormat_LDADD = -lgtest $(LIBAUDIOFILE) - - InvalidSampleFormat_SOURCES = InvalidSampleFormat.cpp TestUtilities.cpp TestUtilities.h --InvalidSampleFormat_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+InvalidSampleFormat_LDADD = -lgtest $(LIBAUDIOFILE) - - Large_SOURCES = Large.cpp TestUtilities.cpp TestUtilities.h --Large_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Large_LDADD = -lgtest $(LIBAUDIOFILE) - - Loop_SOURCES = Loop.cpp TestUtilities.cpp TestUtilities.h --Loop_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Loop_LDADD = -lgtest $(LIBAUDIOFILE) - - Marker_SOURCES = Marker.cpp TestUtilities.cpp TestUtilities.h --Marker_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Marker_LDADD = -lgtest $(LIBAUDIOFILE) - - Miscellaneous_SOURCES = Miscellaneous.cpp TestUtilities.cpp TestUtilities.h --Miscellaneous_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Miscellaneous_LDADD = -lgtest $(LIBAUDIOFILE) - - NeXT_SOURCES = NeXT.cpp TestUtilities.cpp TestUtilities.h --NeXT_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+NeXT_LDADD = -lgtest $(LIBAUDIOFILE) - - PCMData_SOURCES = PCMData.cpp TestUtilities.cpp TestUtilities.h --PCMData_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+PCMData_LDADD = -lgtest $(LIBAUDIOFILE) - - PCMMapping_SOURCES = PCMMapping.cpp TestUtilities.cpp TestUtilities.h --PCMMapping_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+PCMMapping_LDADD = -lgtest $(LIBAUDIOFILE) - - Pipe_SOURCES = Pipe.cpp TestUtilities.cpp TestUtilities.h --Pipe_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Pipe_LDADD = -lgtest $(LIBAUDIOFILE) - - Query_SOURCES = Query.cpp TestUtilities.cpp TestUtilities.h --Query_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Query_LDADD = -lgtest $(LIBAUDIOFILE) - - SampleFormat_SOURCES = SampleFormat.cpp TestUtilities.cpp TestUtilities.h --SampleFormat_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+SampleFormat_LDADD = -lgtest $(LIBAUDIOFILE) - - Seek_SOURCES = Seek.cpp TestUtilities.cpp TestUtilities.h --Seek_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Seek_LDADD = -lgtest $(LIBAUDIOFILE) - - Sign_SOURCES = Sign.cpp TestUtilities.cpp TestUtilities.h --Sign_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+Sign_LDADD = -lgtest $(LIBAUDIOFILE) - - VirtualFile_SOURCES = VirtualFile.cpp TestUtilities.cpp TestUtilities.h --VirtualFile_LDADD = $(LIBGTEST) $(LIBAUDIOFILE) -+VirtualFile_LDADD = -lgtest $(LIBAUDIOFILE) - - floatto24_SOURCES = floatto24.c TestUtilities.cpp TestUtilities.h - -- cgit v1.2.3