* [gentoo-commits] repo/gentoo:master commit in: media-sound/wavpack/, media-sound/wavpack/files/
@ 2017-02-15 18:38 Alexis Ballier
0 siblings, 0 replies; 2+ messages in thread
From: Alexis Ballier @ 2017-02-15 18:38 UTC (permalink / raw
To: gentoo-commits
commit: 1454d93b9b9d1372c0d72a6f096a983395817b18
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 15 18:36:48 2017 +0000
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 18:38:26 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1454d93b
media-sound/wavpack: Restrict arm asm to armv7, bug #609168.
Package-Manager: Portage-2.3.3, Repoman-2.3.1
media-sound/wavpack/files/wavpack-5.1.0-armv7.patch | 16 ++++++++++++++++
media-sound/wavpack/wavpack-5.1.0.ebuild | 2 ++
2 files changed, 18 insertions(+)
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-armv7.patch b/media-sound/wavpack/files/wavpack-5.1.0-armv7.patch
new file mode 100644
index 0000000000..80da2bffc0
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-armv7.patch
@@ -0,0 +1,16 @@
+ARM asm is armv7 only in wavpack. Restrict based on host cpu.
+https://bugs.gentoo.org/show_bug.cgi?id=609168
+
+Index: wavpack-5.1.0/configure.ac
+===================================================================
+--- wavpack-5.1.0.orig/configure.ac
++++ wavpack-5.1.0/configure.ac
+@@ -159,7 +159,7 @@ AS_IF([test "x$enable_asm" != "xno"],[
+ AS_CASE([$host_cpu],
+ [i386|i486|i586|i686|i786], [AC_DEFINE([OPT_ASM_X86]) asm_selected=x86],
+ [x86_64], [AC_DEFINE([OPT_ASM_X64]) asm_selected=x64],
+- [arm*], [AC_DEFINE([OPT_ASM_ARM]) asm_selected=arm],
++ [armv7*], [AC_DEFINE([OPT_ASM_ARM]) asm_selected=arm],
+ [AS_IF([test "x$enable_asm" = "xyes"],[AC_MSG_ERROR(no assembly code for CPU $host_cpu)])]
+ )
+ AC_MSG_RESULT($asm_selected)
diff --git a/media-sound/wavpack/wavpack-5.1.0.ebuild b/media-sound/wavpack/wavpack-5.1.0.ebuild
index 1d06a9692d..51205b40a0 100644
--- a/media-sound/wavpack/wavpack-5.1.0.ebuild
+++ b/media-sound/wavpack/wavpack-5.1.0.ebuild
@@ -4,6 +4,7 @@
EAPI=5
AUTOTOOLS_PRUNE_LIBTOOL_FILES=all
+AUTOTOOLS_AUTORECONF=yes
inherit autotools-multilib
DESCRIPTION="Hybrid lossless audio compression tools"
@@ -21,6 +22,7 @@ RDEPEND=">=virtual/libiconv-0-r1
DEPEND="${RDEPEND}"
DOCS=( ChangeLog README )
+PATCHES=( "${FILESDIR}/${P}-armv7.patch" )
multilib_src_configure() {
local myeconfargs=(
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: media-sound/wavpack/, media-sound/wavpack/files/
@ 2018-08-22 20:43 Andreas Sturmlechner
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Sturmlechner @ 2018-08-22 20:43 UTC (permalink / raw
To: gentoo-commits
commit: 5e53d3522da5a2474983143001f72547b953666d
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 22 20:36:55 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Aug 22 20:42:47 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e53d352
media-sound/wavpack: Multiple security fixes
CVE-2018-7254,CVE-2018-7253, CVE-2018-6767, CVE-2018-10540,
CVE-2018-10539,CVE-2018-10538, CVE-2018-10537, CVE-2018-10536
Bug: https://bugs.gentoo.org/654532
Package-Manager: Portage-2.3.48, Repoman-2.3.10
...vpack-5.1.0-CVE-2018-10536-CVE-2018-10537.patch | 59 +++++++++++
...-2018-10538-CVE-2018-10539-CVE-2018-10540.patch | 70 +++++++++++++
.../files/wavpack-5.1.0-CVE-2018-6767.patch | 111 +++++++++++++++++++++
.../files/wavpack-5.1.0-CVE-2018-7253.patch | 31 ++++++
.../files/wavpack-5.1.0-CVE-2018-7254.patch | 64 ++++++++++++
.../wavpack/files/wavpack-5.1.0-memleaks.patch | 32 ++++++
media-sound/wavpack/wavpack-5.1.0-r1.ebuild | 8 +-
7 files changed, 374 insertions(+), 1 deletion(-)
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10536-CVE-2018-10537.patch b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10536-CVE-2018-10537.patch
new file mode 100644
index 00000000000..d8ac3552ddd
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10536-CVE-2018-10537.patch
@@ -0,0 +1,59 @@
+From: David Bryant <david@wavpack.com>
+Date: Tue, 24 Apr 2018 22:18:07 -0700
+Subject: issue #30 issue #31 issue #32: no multiple format chunks in WAV or
+ W64
+
+---
+ cli/riff.c | 7 ++++++-
+ cli/wave64.c | 6 ++++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/cli/riff.c b/cli/riff.c
+index 7bddf63..5d6452e 100644
+--- a/cli/riff.c
++++ b/cli/riff.c
+@@ -53,7 +53,7 @@ extern int debug_logging_mode;
+
+ int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config)
+ {
+- int is_rf64 = !strncmp (fourcc, "RF64", 4), got_ds64 = 0;
++ int is_rf64 = !strncmp (fourcc, "RF64", 4), got_ds64 = 0, format_chunk = 0;
+ int64_t total_samples = 0, infilesize;
+ RiffChunkHeader riff_chunk_header;
+ ChunkHeader chunk_header;
+@@ -140,6 +140,11 @@ int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+ else if (!strncmp (chunk_header.ckID, "fmt ", 4)) { // if it's the format chunk, we want to get some info out of there and
+ int supported = TRUE, format; // make sure it's a .wav file we can handle
+
++ if (format_chunk++) {
++ error_line ("%s is not a valid .WAV file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
+ if (chunk_header.ckSize < 16 || chunk_header.ckSize > sizeof (WaveHeader) ||
+ !DoReadFile (infile, &WaveHeader, chunk_header.ckSize, &bcount) ||
+ bcount != chunk_header.ckSize) {
+diff --git a/cli/wave64.c b/cli/wave64.c
+index fa928a0..0388dc7 100644
+--- a/cli/wave64.c
++++ b/cli/wave64.c
+@@ -53,6 +53,7 @@ int ParseWave64HeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
+ Wave64ChunkHeader chunk_header;
+ Wave64FileHeader filehdr;
+ WaveHeader WaveHeader;
++ int format_chunk = 0;
+ uint32_t bcount;
+
+ infilesize = DoGetFileSize (infile);
+@@ -104,6 +105,11 @@ int ParseWave64HeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
+ if (!memcmp (chunk_header.ckID, fmt_guid, sizeof (fmt_guid))) {
+ int supported = TRUE, format;
+
++ if (format_chunk++) {
++ error_line ("%s is not a valid .W64 file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
+ chunk_header.ckSize = (chunk_header.ckSize + 7) & ~7L;
+
+ if (chunk_header.ckSize < 16 || chunk_header.ckSize > sizeof (WaveHeader) ||
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10538-CVE-2018-10539-CVE-2018-10540.patch b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10538-CVE-2018-10539-CVE-2018-10540.patch
new file mode 100644
index 00000000000..d924bb624bd
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-10538-CVE-2018-10539-CVE-2018-10540.patch
@@ -0,0 +1,70 @@
+From: David Bryant <david@wavpack.com>
+Date: Tue, 24 Apr 2018 17:27:01 -0700
+Subject: issue #33, sanitize size of unknown chunks before malloc()
+
+---
+ cli/dsdiff.c | 9 ++++++++-
+ cli/riff.c | 9 ++++++++-
+ cli/wave64.c | 9 ++++++++-
+ 3 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/cli/dsdiff.c b/cli/dsdiff.c
+index c016df9..fa56bbb 100644
+--- a/cli/dsdiff.c
++++ b/cli/dsdiff.c
+@@ -279,7 +279,14 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
+ else { // just copy unknown chunks to output file
+
+ int bytes_to_copy = (int)(((dff_chunk_header.ckDataSize) + 1) & ~(int64_t)1);
+- char *buff = malloc (bytes_to_copy);
++ char *buff;
++
++ if (bytes_to_copy < 0 || bytes_to_copy > 4194304) {
++ error_line ("%s is not a valid .DFF file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ buff = malloc (bytes_to_copy);
+
+ if (debug_logging_mode)
+ error_line ("extra unknown chunk \"%c%c%c%c\" of %d bytes",
+diff --git a/cli/riff.c b/cli/riff.c
+index de98c1e..7bddf63 100644
+--- a/cli/riff.c
++++ b/cli/riff.c
+@@ -286,7 +286,14 @@ int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+ else { // just copy unknown chunks to output file
+
+ int bytes_to_copy = (chunk_header.ckSize + 1) & ~1L;
+- char *buff = malloc (bytes_to_copy);
++ char *buff;
++
++ if (bytes_to_copy < 0 || bytes_to_copy > 4194304) {
++ error_line ("%s is not a valid .WAV file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ buff = malloc (bytes_to_copy);
+
+ if (debug_logging_mode)
+ error_line ("extra unknown chunk \"%c%c%c%c\" of %d bytes",
+diff --git a/cli/wave64.c b/cli/wave64.c
+index 591d640..fa928a0 100644
+--- a/cli/wave64.c
++++ b/cli/wave64.c
+@@ -241,7 +241,14 @@ int ParseWave64HeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
+ }
+ else { // just copy unknown chunks to output file
+ int bytes_to_copy = (chunk_header.ckSize + 7) & ~7L;
+- char *buff = malloc (bytes_to_copy);
++ char *buff;
++
++ if (bytes_to_copy < 0 || bytes_to_copy > 4194304) {
++ error_line ("%s is not a valid .W64 file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ buff = malloc (bytes_to_copy);
+
+ if (debug_logging_mode)
+ error_line ("extra unknown chunk \"%c%c%c%c\" of %d bytes",
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-6767.patch b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-6767.patch
new file mode 100644
index 00000000000..aa2cdd40fb6
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-6767.patch
@@ -0,0 +1,111 @@
+From: David Bryant <david@wavpack.com>
+Date: Sun, 4 Feb 2018 11:28:15 -0800
+Subject: issue #27, do not overwrite stack on corrupt RF64 file
+
+---
+ cli/riff.c | 39 ++++++++++++++++++++++++++++++++-------
+ 1 file changed, 32 insertions(+), 7 deletions(-)
+
+diff --git a/cli/riff.c b/cli/riff.c
+index 8b1af45..de98c1e 100644
+--- a/cli/riff.c
++++ b/cli/riff.c
+@@ -42,6 +42,7 @@ typedef struct {
+
+ #pragma pack(pop)
+
++#define CS64ChunkFormat "4D"
+ #define DS64ChunkFormat "DDDL"
+
+ #define WAVPACK_NO_ERROR 0
+@@ -101,13 +102,13 @@ int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+
+ if (!strncmp (chunk_header.ckID, "ds64", 4)) {
+ if (chunk_header.ckSize < sizeof (DS64Chunk) ||
+- !DoReadFile (infile, &ds64_chunk, chunk_header.ckSize, &bcount) ||
+- bcount != chunk_header.ckSize) {
++ !DoReadFile (infile, &ds64_chunk, sizeof (DS64Chunk), &bcount) ||
++ bcount != sizeof (DS64Chunk)) {
+ error_line ("%s is not a valid .WAV file!", infilename);
+ return WAVPACK_SOFT_ERROR;
+ }
+ else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) &&
+- !WavpackAddWrapper (wpc, &ds64_chunk, chunk_header.ckSize)) {
++ !WavpackAddWrapper (wpc, &ds64_chunk, sizeof (DS64Chunk))) {
+ error_line ("%s", WavpackGetErrorMessage (wpc));
+ return WAVPACK_SOFT_ERROR;
+ }
+@@ -315,10 +316,11 @@ int ParseRiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+
+ int WriteRiffHeader (FILE *outfile, WavpackContext *wpc, int64_t total_samples, int qmode)
+ {
+- int do_rf64 = 0, write_junk = 1;
++ int do_rf64 = 0, write_junk = 1, table_length = 0;
+ ChunkHeader ds64hdr, datahdr, fmthdr;
+ RiffChunkHeader riffhdr;
+ DS64Chunk ds64_chunk;
++ CS64Chunk cs64_chunk;
+ JunkChunk junkchunk;
+ WaveHeader wavhdr;
+ uint32_t bcount;
+@@ -380,6 +382,7 @@ int WriteRiffHeader (FILE *outfile, WavpackContext *wpc, int64_t total_samples,
+ strncpy (riffhdr.formType, "WAVE", sizeof (riffhdr.formType));
+ total_riff_bytes = sizeof (riffhdr) + wavhdrsize + sizeof (datahdr) + ((total_data_bytes + 1) & ~(int64_t)1);
+ if (do_rf64) total_riff_bytes += sizeof (ds64hdr) + sizeof (ds64_chunk);
++ total_riff_bytes += table_length * sizeof (CS64Chunk);
+ if (write_junk) total_riff_bytes += sizeof (junkchunk);
+ strncpy (fmthdr.ckID, "fmt ", sizeof (fmthdr.ckID));
+ strncpy (datahdr.ckID, "data", sizeof (datahdr.ckID));
+@@ -394,11 +397,12 @@ int WriteRiffHeader (FILE *outfile, WavpackContext *wpc, int64_t total_samples,
+
+ if (do_rf64) {
+ strncpy (ds64hdr.ckID, "ds64", sizeof (ds64hdr.ckID));
+- ds64hdr.ckSize = sizeof (ds64_chunk);
++ ds64hdr.ckSize = sizeof (ds64_chunk) + (table_length * sizeof (CS64Chunk));
+ CLEAR (ds64_chunk);
+ ds64_chunk.riffSize64 = total_riff_bytes;
+ ds64_chunk.dataSize64 = total_data_bytes;
+ ds64_chunk.sampleCount64 = total_samples;
++ ds64_chunk.tableLength = table_length;
+ riffhdr.ckSize = (uint32_t) -1;
+ datahdr.ckSize = (uint32_t) -1;
+ WavpackNativeToLittleEndian (&ds64hdr, ChunkHeaderFormat);
+@@ -409,6 +413,14 @@ int WriteRiffHeader (FILE *outfile, WavpackContext *wpc, int64_t total_samples,
+ datahdr.ckSize = (uint32_t) total_data_bytes;
+ }
+
++ // this "table" is just a dummy placeholder for testing (normally not written)
++
++ if (table_length) {
++ strncpy (cs64_chunk.ckID, "dmmy", sizeof (cs64_chunk.ckID));
++ cs64_chunk.chunkSize64 = 12345678;
++ WavpackNativeToLittleEndian (&cs64_chunk, CS64ChunkFormat);
++ }
++
+ // write the RIFF chunks up to just before the data starts
+
+ WavpackNativeToLittleEndian (&riffhdr, ChunkHeaderFormat);
+@@ -418,8 +430,21 @@ int WriteRiffHeader (FILE *outfile, WavpackContext *wpc, int64_t total_samples,
+
+ if (!DoWriteFile (outfile, &riffhdr, sizeof (riffhdr), &bcount) || bcount != sizeof (riffhdr) ||
+ (do_rf64 && (!DoWriteFile (outfile, &ds64hdr, sizeof (ds64hdr), &bcount) || bcount != sizeof (ds64hdr))) ||
+- (do_rf64 && (!DoWriteFile (outfile, &ds64_chunk, sizeof (ds64_chunk), &bcount) || bcount != sizeof (ds64_chunk))) ||
+- (write_junk && (!DoWriteFile (outfile, &junkchunk, sizeof (junkchunk), &bcount) || bcount != sizeof (junkchunk))) ||
++ (do_rf64 && (!DoWriteFile (outfile, &ds64_chunk, sizeof (ds64_chunk), &bcount) || bcount != sizeof (ds64_chunk)))) {
++ error_line ("can't write .WAV data, disk probably full!");
++ return FALSE;
++ }
++
++ // again, this is normally not written except for testing
++
++ while (table_length--)
++ if (!DoWriteFile (outfile, &cs64_chunk, sizeof (cs64_chunk), &bcount) || bcount != sizeof (cs64_chunk)) {
++ error_line ("can't write .WAV data, disk probably full!");
++ return FALSE;
++ }
++
++
++ if ((write_junk && (!DoWriteFile (outfile, &junkchunk, sizeof (junkchunk), &bcount) || bcount != sizeof (junkchunk))) ||
+ !DoWriteFile (outfile, &fmthdr, sizeof (fmthdr), &bcount) || bcount != sizeof (fmthdr) ||
+ !DoWriteFile (outfile, &wavhdr, wavhdrsize, &bcount) || bcount != wavhdrsize ||
+ !DoWriteFile (outfile, &datahdr, sizeof (datahdr), &bcount) || bcount != sizeof (datahdr)) {
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7253.patch b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7253.patch
new file mode 100644
index 00000000000..2bf554d8b52
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7253.patch
@@ -0,0 +1,31 @@
+From: David Bryant <david@wavpack.com>
+Date: Sat, 10 Feb 2018 16:01:39 -0800
+Subject: issue #28, do not overwrite heap on corrupt DSDIFF file
+
+---
+ cli/dsdiff.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/cli/dsdiff.c b/cli/dsdiff.c
+index 410dc1c..c016df9 100644
+--- a/cli/dsdiff.c
++++ b/cli/dsdiff.c
+@@ -153,7 +153,17 @@ int ParseDsdiffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpa
+ error_line ("dsdiff file version = 0x%08x", version);
+ }
+ else if (!strncmp (dff_chunk_header.ckID, "PROP", 4)) {
+- char *prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);
++ char *prop_chunk;
++
++ if (dff_chunk_header.ckDataSize < 4 || dff_chunk_header.ckDataSize > 1024) {
++ error_line ("%s is not a valid .DFF file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ if (debug_logging_mode)
++ error_line ("got PROP chunk of %d bytes total", (int) dff_chunk_header.ckDataSize);
++
++ prop_chunk = malloc ((size_t) dff_chunk_header.ckDataSize);
+
+ if (!DoReadFile (infile, prop_chunk, (uint32_t) dff_chunk_header.ckDataSize, &bcount) ||
+ bcount != dff_chunk_header.ckDataSize) {
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7254.patch b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7254.patch
new file mode 100644
index 00000000000..f6e1cc42b13
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-CVE-2018-7254.patch
@@ -0,0 +1,64 @@
+From: David Bryant <david@wavpack.com>
+Date: Sun, 11 Feb 2018 16:37:47 -0800
+Subject: issue #28, fix buffer overflows and bad allocs on corrupt CAF files
+
+---
+ cli/caff.c | 30 +++++++++++++++++++++++-------
+ 1 file changed, 23 insertions(+), 7 deletions(-)
+
+diff --git a/cli/caff.c b/cli/caff.c
+index ae57c4b..6248a71 100644
+--- a/cli/caff.c
++++ b/cli/caff.c
+@@ -89,8 +89,8 @@ typedef struct
+
+ #define CAFChannelDescriptionFormat "LLLLL"
+
+-static const char TMH_full [] = { 1,2,3,13,9,10,5,6,12,14,15,16,17,9,4,18,7,8,19,20,21 };
+-static const char TMH_std [] = { 1,2,3,11,8,9,5,6,10,12,13,14,15,7,4,16 };
++static const char TMH_full [] = { 1,2,3,13,9,10,5,6,12,14,15,16,17,9,4,18,7,8,19,20,21,0 };
++static const char TMH_std [] = { 1,2,3,11,8,9,5,6,10,12,13,14,15,7,4,16,0 };
+
+ static struct {
+ uint32_t mChannelLayoutTag; // Core Audio layout, 100 - 146 in high word, num channels in low word
+@@ -274,10 +274,19 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+ }
+ }
+ else if (!strncmp (caf_chunk_header.mChunkType, "chan", 4)) {
+- CAFChannelLayout *caf_channel_layout = malloc ((size_t) caf_chunk_header.mChunkSize);
++ CAFChannelLayout *caf_channel_layout;
+
+- if (caf_chunk_header.mChunkSize < sizeof (CAFChannelLayout) ||
+- !DoReadFile (infile, caf_channel_layout, (uint32_t) caf_chunk_header.mChunkSize, &bcount) ||
++ if (caf_chunk_header.mChunkSize < sizeof (CAFChannelLayout) || caf_chunk_header.mChunkSize > 1024) {
++ error_line ("this .CAF file has an invalid 'chan' chunk!");
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ if (debug_logging_mode)
++ error_line ("'chan' chunk is %d bytes", (int) caf_chunk_header.mChunkSize);
++
++ caf_channel_layout = malloc ((size_t) caf_chunk_header.mChunkSize);
++
++ if (!DoReadFile (infile, caf_channel_layout, (uint32_t) caf_chunk_header.mChunkSize, &bcount) ||
+ bcount != caf_chunk_header.mChunkSize) {
+ error_line ("%s is not a valid .CAF file!", infilename);
+ free (caf_channel_layout);
+@@ -495,8 +504,15 @@ int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, Wavpack
+ }
+ else { // just copy unknown chunks to output file
+
+- int bytes_to_copy = (uint32_t) caf_chunk_header.mChunkSize;
+- char *buff = malloc (bytes_to_copy);
++ uint32_t bytes_to_copy = (uint32_t) caf_chunk_header.mChunkSize;
++ char *buff;
++
++ if (caf_chunk_header.mChunkSize < 0 || caf_chunk_header.mChunkSize > 1048576) {
++ error_line ("%s is not a valid .CAF file!", infilename);
++ return WAVPACK_SOFT_ERROR;
++ }
++
++ buff = malloc (bytes_to_copy);
+
+ if (debug_logging_mode)
+ error_line ("extra unknown chunk \"%c%c%c%c\" of %d bytes",
diff --git a/media-sound/wavpack/files/wavpack-5.1.0-memleaks.patch b/media-sound/wavpack/files/wavpack-5.1.0-memleaks.patch
new file mode 100644
index 00000000000..18f782fa772
--- /dev/null
+++ b/media-sound/wavpack/files/wavpack-5.1.0-memleaks.patch
@@ -0,0 +1,32 @@
+From: David Bryant <david@wavpack.com>
+Date: Sun, 8 Apr 2018 16:27:40 -0700
+Subject: fix memory leaks
+
+---
+ src/common_utils.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/common_utils.c b/src/common_utils.c
+index caf6b8f..629e60e 100644
+--- a/src/common_utils.c
++++ b/src/common_utils.c
+@@ -373,6 +373,19 @@ WavpackContext *WavpackCloseFile (WavpackContext *wpc)
+
+ WavpackFreeWrapper (wpc);
+
++ if (wpc->metadata) {
++ int i;
++
++ for (i = 0; i < wpc->metacount; ++i)
++ if (wpc->metadata [i].data)
++ free (wpc->metadata [i].data);
++
++ free (wpc->metadata);
++ }
++
++ if (wpc->channel_identities)
++ free (wpc->channel_identities);
++
+ if (wpc->channel_reordering)
+ free (wpc->channel_reordering);
+
diff --git a/media-sound/wavpack/wavpack-5.1.0-r1.ebuild b/media-sound/wavpack/wavpack-5.1.0-r1.ebuild
index 39cd22ab4e6..d65b6d45c07 100644
--- a/media-sound/wavpack/wavpack-5.1.0-r1.ebuild
+++ b/media-sound/wavpack/wavpack-5.1.0-r1.ebuild
@@ -17,7 +17,13 @@ IUSE="static-libs"
RDEPEND=">=virtual/libiconv-0-r1"
DEPEND="${RDEPEND}"
-PATCHES=( "${FILESDIR}/${P}-armv7.patch" )
+PATCHES=(
+ "${FILESDIR}"/${P}-armv7.patch
+ "${FILESDIR}"/${P}-CVE-2018-{6767,7253,7254}.patch
+ "${FILESDIR}"/${P}-CVE-2018-10536-CVE-2018-10537.patch
+ "${FILESDIR}"/${P}-CVE-2018-10538-CVE-2018-10539-CVE-2018-10540.patch
+ "${FILESDIR}"/${P}-memleaks.patch
+)
src_prepare() {
default
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-22 20:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-22 20:43 [gentoo-commits] repo/gentoo:master commit in: media-sound/wavpack/, media-sound/wavpack/files/ Andreas Sturmlechner
-- strict thread matches above, loose matches on Subject: below --
2017-02-15 18:38 Alexis Ballier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox