summaryrefslogtreecommitdiff
path: root/media-libs/audiofile/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /media-libs/audiofile/files
reinit the tree, so we can have metadata
Diffstat (limited to 'media-libs/audiofile/files')
-rw-r--r--media-libs/audiofile/files/audiofile-0.3.6-CVE-2015-7747.patch156
-rw-r--r--media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch127
-rw-r--r--media-libs/audiofile/files/audiofile-0.3.6-mingw32.patch20
-rw-r--r--media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch106
4 files changed, 409 insertions, 0 deletions
diff --git a/media-libs/audiofile/files/audiofile-0.3.6-CVE-2015-7747.patch b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2015-7747.patch
new file mode 100644
index 000000000000..332563959106
--- /dev/null
+++ b/media-libs/audiofile/files/audiofile-0.3.6-CVE-2015-7747.patch
@@ -0,0 +1,156 @@
+Description: fix buffer overflow when changing both sample format and
+ number of channels
+Origin: https://github.com/mpruett/audiofile/pull/25
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/audiofile/+bug/1502721
+Bug-Debian: https://bugs.debian.org/801102
+
+--- a/libaudiofile/modules/ModuleState.cpp
++++ b/libaudiofile/modules/ModuleState.cpp
+@@ -402,7 +402,7 @@ status ModuleState::arrange(AFfilehandle
+ addModule(new Transform(outfc, in.pcm, out.pcm));
+
+ if (in.channelCount != out.channelCount)
+- addModule(new ApplyChannelMatrix(infc, isReading,
++ addModule(new ApplyChannelMatrix(outfc, isReading,
+ in.channelCount, out.channelCount,
+ in.pcm.minClip, in.pcm.maxClip,
+ track->channelMatrix));
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -26,6 +26,7 @@ TESTS = \
+ VirtualFile \
+ floatto24 \
+ query2 \
++ sixteen-stereo-to-eight-mono \
+ sixteen-to-eight \
+ testchannelmatrix \
+ testdouble \
+@@ -139,6 +140,7 @@ printmarkers_SOURCES = printmarkers.c
+ printmarkers_LDADD = $(LIBAUDIOFILE) -lm
+
+ sixteen_to_eight_SOURCES = sixteen-to-eight.c TestUtilities.cpp TestUtilities.h
++sixteen_stereo_to_eight_mono_SOURCES = sixteen-stereo-to-eight-mono.c TestUtilities.cpp TestUtilities.h
+
+ testchannelmatrix_SOURCES = testchannelmatrix.c TestUtilities.cpp TestUtilities.h
+
+--- /dev/null
++++ b/test/sixteen-stereo-to-eight-mono.c
+@@ -0,0 +1,118 @@
++/*
++ Audio File Library
++
++ Copyright 2000, Silicon Graphics, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License along
++ with this program; if not, write to the Free Software Foundation, Inc.,
++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++*/
++
++/*
++ sixteen-stereo-to-eight-mono.c
++
++ This program tests the conversion from 2-channel 16-bit integers to
++ 1-channel 8-bit integers.
++*/
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <stdint.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++#include <limits.h>
++
++#include <audiofile.h>
++
++#include "TestUtilities.h"
++
++int main (int argc, char **argv)
++{
++ AFfilehandle file;
++ AFfilesetup setup;
++ int16_t frames16[] = {14298, 392, 3923, -683, 958, -1921};
++ int8_t frames8[] = {28, 6, -2};
++ int i, frameCount = 3;
++ int8_t byte;
++ AFframecount result;
++
++ setup = afNewFileSetup();
++
++ afInitFileFormat(setup, AF_FILE_WAVE);
++
++ afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16);
++ afInitChannels(setup, AF_DEFAULT_TRACK, 2);
++
++ char *testFileName;
++ if (!createTemporaryFile("sixteen-to-eight", &testFileName))
++ {
++ fprintf(stderr, "Could not create temporary file.\n");
++ exit(EXIT_FAILURE);
++ }
++
++ file = afOpenFile(testFileName, "w", setup);
++ if (file == AF_NULL_FILEHANDLE)
++ {
++ fprintf(stderr, "could not open file for writing\n");
++ exit(EXIT_FAILURE);
++ }
++
++ afFreeFileSetup(setup);
++
++ afWriteFrames(file, AF_DEFAULT_TRACK, frames16, frameCount);
++
++ afCloseFile(file);
++
++ file = afOpenFile(testFileName, "r", AF_NULL_FILESETUP);
++ if (file == AF_NULL_FILEHANDLE)
++ {
++ fprintf(stderr, "could not open file for reading\n");
++ exit(EXIT_FAILURE);
++ }
++
++ afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 8);
++ afSetVirtualChannels(file, AF_DEFAULT_TRACK, 1);
++
++ for (i=0; i<frameCount; i++)
++ {
++ /* Read one frame. */
++ result = afReadFrames(file, AF_DEFAULT_TRACK, &byte, 1);
++
++ if (result != 1)
++ break;
++
++ /* Compare the byte read with its precalculated value. */
++ if (memcmp(&byte, &frames8[i], 1) != 0)
++ {
++ printf("error\n");
++ printf("expected %d, got %d\n", frames8[i], byte);
++ exit(EXIT_FAILURE);
++ }
++ else
++ {
++#ifdef DEBUG
++ printf("got what was expected: %d\n", byte);
++#endif
++ }
++ }
++
++ afCloseFile(file);
++ unlink(testFileName);
++ free(testFileName);
++
++ exit(EXIT_SUCCESS);
++}
diff --git a/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch b/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch
new file mode 100644
index 000000000000..02d96f19853f
--- /dev/null
+++ b/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch
@@ -0,0 +1,127 @@
+From 308571e254ad30101be8c1247d2b0b64cf488386 Mon Sep 17 00:00:00 2001
+From: Michael Schwendt <mschwendt@fedoraproject.org>
+Date: Wed, 3 Feb 2016 21:56:11 +0100
+Subject: [PATCH] left shifting a negative int is undefined behaviour /
+ narrowing conversion issues / for GCC 6
+
+fix left shifts for 32-bit to avoid int overflow
+
+avoid int overflow too
+
+char on ARM is unsigned by default
+---
+ libaudiofile/modules/SimpleModule.h | 2 +-
+ test/FloatToInt.cpp | 2 +-
+ test/IntToFloat.cpp | 2 +-
+ test/NeXT.cpp | 14 +++++++-------
+ test/Sign.cpp | 2 +-
+ 5 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/libaudiofile/modules/SimpleModule.h b/libaudiofile/modules/SimpleModule.h
+index 03c6c69..e4cc138 100644
+--- a/libaudiofile/modules/SimpleModule.h
++++ b/libaudiofile/modules/SimpleModule.h
+@@ -123,7 +123,7 @@ struct signConverter
+ typedef typename IntTypes<Format>::UnsignedType UnsignedType;
+
+ static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
+- static const int kMinSignedValue = -1 << kScaleBits;
++ static const int kMinSignedValue = 0-(1U<<kScaleBits);
+
+ struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType>
+ {
+diff --git a/test/FloatToInt.cpp b/test/FloatToInt.cpp
+index 0d179a8..bf491b2 100644
+--- a/test/FloatToInt.cpp
++++ b/test/FloatToInt.cpp
+@@ -115,7 +115,7 @@ TEST_F(FloatToIntTest, Int16)
+ EXPECT_EQ(readData[i], expectedData[i]);
+ }
+
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+
+ TEST_F(FloatToIntTest, Int24)
+diff --git a/test/IntToFloat.cpp b/test/IntToFloat.cpp
+index b716635..1d91b58 100644
+--- a/test/IntToFloat.cpp
++++ b/test/IntToFloat.cpp
+@@ -117,7 +117,7 @@ TEST_F(IntToFloatTest, Int16)
+ EXPECT_EQ(readData[i], expectedData[i]);
+ }
+
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+
+ TEST_F(IntToFloatTest, Int24)
+diff --git a/test/NeXT.cpp b/test/NeXT.cpp
+index 7e39850..a37cea1 100644
+--- a/test/NeXT.cpp
++++ b/test/NeXT.cpp
+@@ -37,13 +37,13 @@
+
+ #include "TestUtilities.h"
+
+-const char kDataUnspecifiedLength[] =
++const signed char kDataUnspecifiedLength[] =
+ {
+ '.', 's', 'n', 'd',
+ 0, 0, 0, 24, // offset of 24 bytes
+- 0xff, 0xff, 0xff, 0xff, // unspecified length
++ -1, -1, -1, -1, // unspecified length
+ 0, 0, 0, 3, // 16-bit linear
+- 0, 0, 172, 68, // 44100 Hz
++ 0, 0, -84, 68, // 44100 Hz (0xAC44)
+ 0, 0, 0, 1, // 1 channel
+ 0, 1,
+ 0, 1,
+@@ -57,13 +57,13 @@ const char kDataUnspecifiedLength[] =
+ 0, 55
+ };
+
+-const char kDataTruncated[] =
++const signed char kDataTruncated[] =
+ {
+ '.', 's', 'n', 'd',
+ 0, 0, 0, 24, // offset of 24 bytes
+ 0, 0, 0, 20, // length of 20 bytes
+ 0, 0, 0, 3, // 16-bit linear
+- 0, 0, 172, 68, // 44100 Hz
++ 0, 0, -84, 68, // 44100 Hz (0xAC44)
+ 0, 0, 0, 1, // 1 channel
+ 0, 1,
+ 0, 1,
+@@ -152,13 +152,13 @@ TEST(NeXT, Truncated)
+ ASSERT_EQ(::unlink(testFileName.c_str()), 0);
+ }
+
+-const char kDataZeroChannels[] =
++const signed char kDataZeroChannels[] =
+ {
+ '.', 's', 'n', 'd',
+ 0, 0, 0, 24, // offset of 24 bytes
+ 0, 0, 0, 2, // 2 bytes
+ 0, 0, 0, 3, // 16-bit linear
+- 0, 0, 172, 68, // 44100 Hz
++ 0, 0, -84, 68, // 44100 Hz (0xAC44)
+ 0, 0, 0, 0, // 0 channels
+ 0, 1
+ };
+diff --git a/test/Sign.cpp b/test/Sign.cpp
+index 7275399..c339514 100644
+--- a/test/Sign.cpp
++++ b/test/Sign.cpp
+@@ -116,7 +116,7 @@ TEST_F(SignConversionTest, Int16)
+ EXPECT_EQ(readData[i], expectedData[i]);
+ }
+
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+ static const uint32_t kMaxUInt24 = (1<<24) - 1;
+
+--
+2.10.1
+
diff --git a/media-libs/audiofile/files/audiofile-0.3.6-mingw32.patch b/media-libs/audiofile/files/audiofile-0.3.6-mingw32.patch
new file mode 100644
index 000000000000..8ed7cb0534ff
--- /dev/null
+++ b/media-libs/audiofile/files/audiofile-0.3.6-mingw32.patch
@@ -0,0 +1,20 @@
+bzero() is a POSIX-specific fuinction.
+x86_64-w64-mingw32-gcc does not provide one.
+
+https://github.com/mpruett/audiofile/commit/d9363a5d16af4ce55eb35c5aad9ca19bb9c53cbe
+
+commit d9363a5d16af4ce55eb35c5aad9ca19bb9c53cbe
+Author: Daniel Verkamp <daniel@drv.nu>
+Date: Mon Jul 4 21:57:44 2016 -0500
+
+ Replace bzero() with memset().
+
+diff --git a/libaudiofile/CAF.cpp b/libaudiofile/CAF.cpp
+index d2b62ea..5752117 100644
+--- a/libaudiofile/CAF.cpp
++++ b/libaudiofile/CAF.cpp
+@@ -720,3 +720,3 @@ void CAFFile::initALACCompressionParams()
+ m_codecData = new Buffer(codecDataSize);
+- bzero(m_codecData->data(), m_codecData->size());
++ memset(m_codecData->data(), 0, m_codecData->size());
+
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
new file mode 100644
index 000000000000..31e77e11271d
--- /dev/null
+++ b/media-libs/audiofile/files/audiofile-0.3.6-system-gtest.patch
@@ -0,0 +1,106 @@
+--- 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
+