diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2018-10-03 21:16:17 +0200 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2018-10-03 21:22:05 +0200 |
commit | b8fc21b710b18e21dfba9506f666ec18744a3e64 (patch) | |
tree | fdd9d9509e22fb666ce5855068209683234d937e /media-libs/libsndfile/files | |
parent | sys-apps/openrc-0.38.2: arm64 stable (bug #658854) (diff) | |
download | gentoo-b8fc21b710b18e21dfba9506f666ec18744a3e64.tar.gz gentoo-b8fc21b710b18e21dfba9506f666ec18744a3e64.tar.bz2 gentoo-b8fc21b710b18e21dfba9506f666ec18744a3e64.zip |
media-libs/libsndfile: Fix multiple vulnerabilities
Bug: https://bugs.gentoo.org/618016
Bug: https://bugs.gentoo.org/631634
Bug: https://bugs.gentoo.org/624814
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Package-Manager: Portage-2.3.50, Repoman-2.3.11
Diffstat (limited to 'media-libs/libsndfile/files')
6 files changed, 203 insertions, 1 deletions
diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-14634.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-14634.patch new file mode 100644 index 000000000000..9eab370aac47 --- /dev/null +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-14634.patch @@ -0,0 +1,35 @@ +From 85c877d5072866aadbe8ed0c3e0590fbb5e16788 Mon Sep 17 00:00:00 2001 +From: Fabian Greffrath <fabian@greffrath.com> +Date: Thu, 28 Sep 2017 12:15:04 +0200 +Subject: [PATCH] double64_init: Check psf->sf.channels against upper bound + +This prevents division by zero later in the code. + +While the trivial case to catch this (i.e. sf.channels < 1) has already +been covered, a crafted file may report a number of channels that is +so high (i.e. > INT_MAX/sizeof(double)) that it "somehow" gets +miscalculated to zero (if this makes sense) in the determination of the +blockwidth. Since we only support a limited number of channels anyway, +make sure to check here as well. + +CVE-2017-14634 + +Closes: https://github.com/erikd/libsndfile/issues/318 +Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com> +--- + src/double64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/double64.c b/src/double64.c +index b318ea86..78dfef7f 100644 +--- a/src/double64.c ++++ b/src/double64.c +@@ -91,7 +91,7 @@ int + double64_init (SF_PRIVATE *psf) + { static int double64_caps ; + +- if (psf->sf.channels < 1) ++ if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS) + { psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ; + return SFE_INTERNAL ; + } ; diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-6892.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-6892.patch new file mode 100644 index 000000000000..d5ccf726684a --- /dev/null +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-6892.patch @@ -0,0 +1,25 @@ +From f833c53cb596e9e1792949f762e0b33661822748 Mon Sep 17 00:00:00 2001 +From: Erik de Castro Lopo <erikd@mega-nerd.com> +Date: Tue, 23 May 2017 20:15:24 +1000 +Subject: [PATCH] src/aiff.c: Fix a buffer read overflow + +Secunia Advisory SA76717. + +Found by: Laurent Delosieres, Secunia Research at Flexera Software +--- + src/aiff.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/aiff.c b/src/aiff.c +index 5b5f9f53..45864b76 100644 +--- a/src/aiff.c ++++ b/src/aiff.c +@@ -1759,7 +1759,7 @@ aiff_read_chanmap (SF_PRIVATE * psf, unsigned dword) + psf_binheader_readf (psf, "j", dword - bytesread) ; + + if (map_info->channel_map != NULL) +- { size_t chanmap_size = psf->sf.channels * sizeof (psf->channel_map [0]) ; ++ { size_t chanmap_size = SF_MIN (psf->sf.channels, layout_tag & 0xffff) * sizeof (psf->channel_map [0]) ; + + free (psf->channel_map) ; + diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8362.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8362.patch new file mode 100644 index 000000000000..54fbfb44c3b1 --- /dev/null +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8362.patch @@ -0,0 +1,50 @@ +From ef1dbb2df1c0e741486646de40bd638a9c4cd808 Mon Sep 17 00:00:00 2001 +From: Erik de Castro Lopo <erikd@mega-nerd.com> +Date: Fri, 14 Apr 2017 15:19:16 +1000 +Subject: [PATCH] src/flac.c: Fix a buffer read overflow + +A file (generated by a fuzzer) which increased the number of channels +from one frame to the next could cause a read beyond the end of the +buffer provided by libFLAC. Only option is to abort the read. + +Closes: https://github.com/erikd/libsndfile/issues/231 +--- + src/flac.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/flac.c b/src/flac.c +index 5a4f8c21..e4f9aaa0 100644 +--- a/src/flac.c ++++ b/src/flac.c +@@ -169,6 +169,14 @@ flac_buffer_copy (SF_PRIVATE *psf) + const int32_t* const *buffer = pflac->wbuffer ; + unsigned i = 0, j, offset, channels, len ; + ++ if (psf->sf.channels != (int) frame->header.channels) ++ { psf_log_printf (psf, "Error: FLAC frame changed from %d to %d channels\n" ++ "Nothing to do but to error out.\n" , ++ psf->sf.channels, frame->header.channels) ; ++ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; ++ return 0 ; ++ } ; ++ + /* + ** frame->header.blocksize is variable and we're using a constant blocksize + ** of FLAC__MAX_BLOCK_SIZE. +@@ -202,7 +210,6 @@ flac_buffer_copy (SF_PRIVATE *psf) + return 0 ; + } ; + +- + len = SF_MIN (pflac->len, frame->header.blocksize) ; + + if (pflac->remain % channels != 0) +@@ -436,7 +443,7 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_ + { case FLAC__METADATA_TYPE_STREAMINFO : + if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels) + { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n" +- "Nothing to be but to error out.\n" , ++ "Nothing to do but to error out.\n" , + psf->sf.channels, metadata->data.stream_info.channels) ; + psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; + return ; diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8363.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8363.patch new file mode 100644 index 000000000000..d0aa400bdd95 --- /dev/null +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8363.patch @@ -0,0 +1,28 @@ +From cd7da8dbf6ee4310d21d9e44b385d6797160d9e8 Mon Sep 17 00:00:00 2001 +From: Erik de Castro Lopo <erikd@mega-nerd.com> +Date: Wed, 12 Apr 2017 20:19:34 +1000 +Subject: [PATCH] src/flac.c: Fix another memory leak + +When the FLAC decoder was passed a malformed file, the associated +`FLAC__StreamDecoder` object was not getting released. + +Closes: https://github.com/erikd/libsndfile/issues/233 +--- + src/flac.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/flac.c b/src/flac.c +index 986a7b8f..5a4f8c21 100644 +--- a/src/flac.c ++++ b/src/flac.c +@@ -841,7 +841,9 @@ flac_read_header (SF_PRIVATE *psf) + + psf_log_printf (psf, "End\n") ; + +- if (psf->error == 0) ++ if (psf->error != 0) ++ FLAC__stream_decoder_delete (pflac->fsd) ; ++ else + { FLAC__uint64 position ; + + FLAC__stream_decoder_get_decode_position (pflac->fsd, &position) ; diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8365.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8365.patch new file mode 100644 index 000000000000..1dc5b57f1d39 --- /dev/null +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2017-8365.patch @@ -0,0 +1,64 @@ +From fd0484aba8e51d16af1e3a880f9b8b857b385eb3 Mon Sep 17 00:00:00 2001 +From: Erik de Castro Lopo <erikd@mega-nerd.com> +Date: Wed, 12 Apr 2017 19:45:30 +1000 +Subject: [PATCH] FLAC: Fix a buffer read overrun + +Buffer read overrun occurs when reading a FLAC file that switches +from 2 channels to one channel mid-stream. Only option is to +abort the read. + +Closes: https://github.com/erikd/libsndfile/issues/230 +--- + src/common.h | 1 + + src/flac.c | 13 +++++++++++++ + src/sndfile.c | 1 + + 3 files changed, 15 insertions(+) + +diff --git a/src/common.h b/src/common.h +index 0bd810c3..e2669b6a 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -725,6 +725,7 @@ enum + SFE_FLAC_INIT_DECODER, + SFE_FLAC_LOST_SYNC, + SFE_FLAC_BAD_SAMPLE_RATE, ++ SFE_FLAC_CHANNEL_COUNT_CHANGED, + SFE_FLAC_UNKOWN_ERROR, + + SFE_WVE_NOT_WVE, +diff --git a/src/flac.c b/src/flac.c +index 84de0e26..986a7b8f 100644 +--- a/src/flac.c ++++ b/src/flac.c +@@ -434,6 +434,19 @@ sf_flac_meta_callback (const FLAC__StreamDecoder * UNUSED (decoder), const FLAC_ + + switch (metadata->type) + { case FLAC__METADATA_TYPE_STREAMINFO : ++ if (psf->sf.channels > 0 && psf->sf.channels != (int) metadata->data.stream_info.channels) ++ { psf_log_printf (psf, "Error: FLAC stream changed from %d to %d channels\n" ++ "Nothing to be but to error out.\n" , ++ psf->sf.channels, metadata->data.stream_info.channels) ; ++ psf->error = SFE_FLAC_CHANNEL_COUNT_CHANGED ; ++ return ; ++ } ; ++ ++ if (psf->sf.channels > 0 && psf->sf.samplerate != (int) metadata->data.stream_info.sample_rate) ++ { psf_log_printf (psf, "Warning: FLAC stream changed sample rates from %d to %d.\n" ++ "Carrying on as if nothing happened.", ++ psf->sf.samplerate, metadata->data.stream_info.sample_rate) ; ++ } ; + psf->sf.channels = metadata->data.stream_info.channels ; + psf->sf.samplerate = metadata->data.stream_info.sample_rate ; + psf->sf.frames = metadata->data.stream_info.total_samples ; +diff --git a/src/sndfile.c b/src/sndfile.c +index 41875610..e2a87be8 100644 +--- a/src/sndfile.c ++++ b/src/sndfile.c +@@ -245,6 +245,7 @@ ErrorStruct SndfileErrors [] = + { SFE_FLAC_INIT_DECODER , "Error : problem with initialization of the flac decoder." }, + { SFE_FLAC_LOST_SYNC , "Error : flac decoder lost sync." }, + { SFE_FLAC_BAD_SAMPLE_RATE, "Error : flac does not support this sample rate." }, ++ { SFE_FLAC_CHANNEL_COUNT_CHANGED, "Error : flac channel changed mid stream." }, + { SFE_FLAC_UNKOWN_ERROR , "Error : unknown error in flac decoder." }, + + { SFE_WVE_NOT_WVE , "Error : not a WVE file." }, diff --git a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2018-13139.patch b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2018-13139.patch index 18e6ae76e62c..f75843267b0b 100644 --- a/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2018-13139.patch +++ b/media-libs/libsndfile/files/libsndfile-1.0.28-CVE-2018-13139.patch @@ -28,4 +28,4 @@ index 53660310..225b4d54 100644 + state.channels = sfinfo.channels ; sfinfo.channels = 1 ; -
\ No newline at end of file + |