Accepting request 578281 from home:kbabioch:branches:multimedia:libs

- Added CVE-2018-7253.patch: Fixed a heap based buffer overread in
  cli/dsdiff.c, which allowed remote attackers to cause DoS via
  a specially crafted input file (CVE-2018-7253, bsc#1081692)
- Added CVE-2018-7254.patch: Fixed a buffer overread in cli/caff.c,
  which allowed remote attackers to cause DoS via a specially
  crafted input file (CVE-2018-7254, bsc#1081693)

OBS-URL: https://build.opensuse.org/request/show/578281
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wavpack?expand=0&rev=22
This commit is contained in:
Tomáš Chvátal 2018-02-20 09:12:21 +00:00 committed by Git OBS Bridge
parent ce2178571d
commit 5a39746c5b
4 changed files with 115 additions and 0 deletions

33
CVE-2018-7253.patch Normal file
View File

@ -0,0 +1,33 @@
From 36a24c7881427d2e1e4dc1cef58f19eee0d13aec Mon Sep 17 00:00:00 2001
From: David Bryant <david@wavpack.com>
Date: Sat, 10 Feb 2018 16:01:39 -0800
Subject: [PATCH] issue #28, do not overwrite heap on corrupt DSDIFF file
Upstream: merged
---
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) {

67
CVE-2018-7254.patch Normal file
View File

@ -0,0 +1,67 @@
From 8e3fe45a7bac31d9a3b558ae0079e2d92a04799e Mon Sep 17 00:00:00 2001
From: David Bryant <david@wavpack.com>
Date: Sun, 11 Feb 2018 16:37:47 -0800
Subject: [PATCH] issue #28, fix buffer overflows and bad allocs on corrupt CAF
files
Upstream: merged
---
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",

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Feb 20 08:48:07 UTC 2018 - kbabioch@suse.com
- Added CVE-2018-7253.patch: Fixed a heap based buffer overread in
cli/dsdiff.c, which allowed remote attackers to cause DoS via
a specially crafted input file (CVE-2018-7253, bsc#1081692)
- Added CVE-2018-7254.patch: Fixed a buffer overread in cli/caff.c,
which allowed remote attackers to cause DoS via a specially
crafted input file (CVE-2018-7254, bsc#1081693)
-------------------------------------------------------------------
Mon Feb 19 16:27:30 UTC 2018 - pmonrealgonzalez@suse.com

View File

@ -29,6 +29,8 @@ Source99: baselibs.conf
# PATCH-FIX-UPSTREAM bsc#1079746 CVE-2018-6767 Crafted wav file can trigger
# a stack buffer overflow when parsing the file
Patch0: wavpack-CVE-2018-6767.patch
Patch1: CVE-2018-7253.patch
Patch2: CVE-2018-7254.patch
BuildRequires: libtool
BuildRequires: pkgconfig
@ -73,6 +75,8 @@ applications that want to make use of wavpack.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
autoreconf -fiv