[PATCH] gnu: wavpack: Fix CVE-2018-7253 and CVE-2018-7254.

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Marius Bakke
Owner
unassigned
Submitted by
Marius Bakke
Severity
normal

Debbugs page

Marius Bakke wrote 7 years ago
(address . guix-patches@gnu.org)(name . Marius Bakke)(address . mbakke@fastmail.com)
20180223122416.7730-1-mbakke@fastmail.com
* gnu/packages/patches/wavpack-CVE-2018-7253.patch,
gnu/packages/patches/wavpack-CVE-2018-7254.patch: New files.
* gnu/local.mk (dist_patch_DATA): Register them.
* gnu/packages/audio.scm (wavpack)[source](patches): Use them.
---
gnu/local.mk | 2 +
gnu/packages/audio.scm | 2 +
gnu/packages/patches/wavpack-CVE-2018-7253.patch | 29 +++++++++++
gnu/packages/patches/wavpack-CVE-2018-7254.patch | 62 ++++++++++++++++++++++++
4 files changed, 95 insertions(+)
create mode 100644 gnu/packages/patches/wavpack-CVE-2018-7253.patch
create mode 100644 gnu/packages/patches/wavpack-CVE-2018-7254.patch

Toggle diff (131 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 7744facce..8128da9d1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1142,6 +1142,8 @@ dist_patch_DATA = \
%D%/packages/patches/vsearch-unbundle-cityhash.patch \
%D%/packages/patches/vte-CVE-2012-2738-pt1.patch \
%D%/packages/patches/vte-CVE-2012-2738-pt2.patch \
+ %D%/packages/patches/wavpack-CVE-2018-7253.patch \
+ %D%/packages/patches/wavpack-CVE-2018-7254.patch \
%D%/packages/patches/weechat-python.patch \
%D%/packages/patches/wicd-bitrate-none-fix.patch \
%D%/packages/patches/wicd-get-selected-profile-fix.patch \
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 47179aea9..b1a15ed34 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -2377,6 +2377,8 @@ stretching and pitch scaling of audio. This package contains the library.")
(method url-fetch)
(uri (string-append "http://www.wavpack.com/"
name "-" version ".tar.bz2"))
+ (patches (search-patches "wavpack-CVE-2018-7253.patch"
+ "wavpack-CVE-2018-7254.patch"))
(sha256
(base32
"0i19c6krc0p9krwrqy9s5xahaafigqzxcn31piidmlaqadyn4f8r"))))
diff --git a/gnu/packages/patches/wavpack-CVE-2018-7253.patch b/gnu/packages/patches/wavpack-CVE-2018-7253.patch
new file mode 100644
index 000000000..651755afd
--- /dev/null
+++ b/gnu/packages/patches/wavpack-CVE-2018-7253.patch
@@ -0,0 +1,29 @@
+Fix CVE-2018-7253:
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7253
+
+Copied from upstream:
+https://github.com/dbry/WavPack/commit/36a24c7881427d2e1e4dc1cef58f19eee0d13aec
+
+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/gnu/packages/patches/wavpack-CVE-2018-7254.patch b/gnu/packages/patches/wavpack-CVE-2018-7254.patch
new file mode 100644
index 000000000..61db296ec
--- /dev/null
+++ b/gnu/packages/patches/wavpack-CVE-2018-7254.patch
@@ -0,0 +1,62 @@
+Fix CVE-2018-7254:
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-7254
+
+Copied from upstream:
+https://github.com/dbry/WavPack/commit/8e3fe45a7bac31d9a3b558ae0079e2d92a04799e
+
+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",
--
2.16.2
Leo Famulari wrote 7 years ago
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 30586@debbugs.gnu.org)
20180223180708.GA32187@jasmine.lan
On Fri, Feb 23, 2018 at 01:24:16PM +0100, Marius Bakke wrote:
Toggle quote (5 lines)
> * gnu/packages/patches/wavpack-CVE-2018-7253.patch,
> gnu/packages/patches/wavpack-CVE-2018-7254.patch: New files.
> * gnu/local.mk (dist_patch_DATA): Register them.
> * gnu/packages/audio.scm (wavpack)[source](patches): Use them.

Thanks, LGTM!
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlqQWEwACgkQJkb6MLrK
fwhcaQ//WBhF5CWs39QnEcvOr1x5WdzghmMA5+730AP91Ry60NZpH5IKxLKRzjZR
PEkQ1B445dklqJB2EY/jhREaxZkw209E8NL7ZwXqQulj0insHb+LKJjneQq+sQuz
AmjF0W3bVG56HayZW3/L7SUddEt2EUMwTQM+3T85f7vU71tTsrmbJsvsMhNEFjry
8jzB0bjIs/zSPgNnU2/tIbqcAs8nzlBY5azO0UsD6fLaAvDR/hm7siMoXRuezR69
Wld75ovTRNtbdR3OV3Dzy4YFnkjUIajDSdp+zrff0XeJA9GJc6UFVJO4TgzU1DDj
o+3w8WyVzjikl5x4BTfUbyR8iGZPyfVz2/NzBOtk6BSpAY5MQ467CNPxdHX8oWB7
rxJ/oQApVuMcZzXsYPgM/J0yDu87GX/0Ib3O9HZnYRbSqr4wHtEPKBXLsmEfk00h
KwGdz4+ffsP8WNgkV5b84JS90HM1EPQJXytqkeG6vbYdkrY9ka5EV5X5GBi1+jh2
e85snRhnHsQtqZw+s/7aJ7SIcTbqZJvlReqqsJVM711/o0p/HULrOhblpP4kvwRl
8/5mmxPLY5isB4EIp5P9yw5RQLCNEX61Sx3M2NknWSBJPnx0C9jfcxRkqr6PQIvO
BPSx9wRh/NrwfXwKGjC3J9eqB9PF/2mfKdGUtqbFurUa4uKtrB4=
=YBqW
-----END PGP SIGNATURE-----


Marius Bakke wrote 7 years ago
(name . Leo Famulari)(address . leo@famulari.name)(address . 30586-done@debbugs.gnu.org)
87606na3x1.fsf@fastmail.com
Leo Famulari <leo@famulari.name> writes:

Toggle quote (8 lines)
> On Fri, Feb 23, 2018 at 01:24:16PM +0100, Marius Bakke wrote:
>> * gnu/packages/patches/wavpack-CVE-2018-7253.patch,
>> gnu/packages/patches/wavpack-CVE-2018-7254.patch: New files.
>> * gnu/local.mk (dist_patch_DATA): Register them.
>> * gnu/packages/audio.scm (wavpack)[source](patches): Use them.
>
> Thanks, LGTM!

Pushed as 65f704f3735fa7c979f36629d402b9458cc96ad0.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqQbqoACgkQoqBt8qM6
VPqpiwgAktbBmSuUWFpthyzqjS7lYe1gwjJtcbkWP5EocJINNsVoRyJY6Qdxp1UK
pmYnXtdX9dOXkySddc6fTU8PRQDJYoRee3dyzQNuENiJXh3c6ETtmyAGbQUoLnn0
ba2l1JvYu5yrupxKk5obaYwzmhzGAqY4iQcuzL8vGG1nLvzy3sTwpiC1Dc7l56+P
wW9XXsA8KrzCxrtELT3WFMCydnMibVqEFyJRRhZ2fNm7PLp6TEs3UzIDdjyKMW80
2Ao7JgUdkM+EhTY+1Ows2wFAh/T9fte7ZqjY1b3mr6wwuIMhW3f/R5SFisudFHAo
KrH5hjsRdstHJlANzP9QOJ/LKwu6rQ==
=xKFN
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 30586@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 30586
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help