aboutsummaryrefslogtreecommitdiffstats
path: root/main/libsndfile
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-07-05 07:39:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-07-05 07:39:03 +0000
commit49b4ba77c180eea380f7eb5db100fc83162143e5 (patch)
tree961f7b93e028513baf145f183f8dcf41d18f6964 /main/libsndfile
parent018b00c3e22e85ddc30d153966483998ecefc95d (diff)
downloadaports-49b4ba77c180eea380f7eb5db100fc83162143e5.tar.bz2
aports-49b4ba77c180eea380f7eb5db100fc83162143e5.tar.xz
fixes #7440
Diffstat (limited to 'main/libsndfile')
-rw-r--r--main/libsndfile/APKBUILD22
-rw-r--r--main/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch64
-rw-r--r--main/libsndfile/CVE-2017-8362.patch50
3 files changed, 127 insertions, 9 deletions
diff --git a/main/libsndfile/APKBUILD b/main/libsndfile/APKBUILD
index 81f9c4d6e4..d894549ca8 100644
--- a/main/libsndfile/APKBUILD
+++ b/main/libsndfile/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libsndfile
pkgver=1.0.28
-pkgrel=0
+pkgrel=1
pkgdesc="A C library for reading and writing files containing sampled sound"
url="http://www.mega-nerd.com/libsndfile"
arch="all"
@@ -11,21 +11,23 @@ subpackages="$pkgname-dev $pkgname-doc"
depends=
depends_dev="flac-dev libvorbis-dev libogg-dev"
makedepends="linux-headers alsa-lib-dev $depends_dev"
-source="http://www.mega-nerd.com/$pkgname/files/$pkgname-$pkgver.tar.gz"
+source="http://www.mega-nerd.com/$pkgname/files/$pkgname-$pkgver.tar.gz
+ CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch
+ CVE-2017-8362.patch
+ "
# secfixes:
# 1.0.28-r0:
# - CVE-2017-7585
# - CVE-2017-7741
# - CVE-2017-7742
+# 1.0.28-r1:
+# - CVE-2017-8361
+# - CVE-2017-8362
+# - CVE-2017-8363
+# - CVE-2017-8365
_builddir="$srcdir/$pkgname-$pkgver"
-
-prepare() {
- cd "$_builddir"
- return 0
-}
-
build () {
cd "$_builddir"
ac_cv_sys_largefile_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \
@@ -43,4 +45,6 @@ package() {
cd "$_builddir"
make DESTDIR="$pkgdir" install || return 1
}
-sha512sums="890731a6b8173f714155ce05eaf6d991b31632c8ab207fbae860968861a107552df26fcf85602df2e7f65502c7256c1b41735e1122485a3a07ddb580aa83b57f libsndfile-1.0.28.tar.gz"
+sha512sums="890731a6b8173f714155ce05eaf6d991b31632c8ab207fbae860968861a107552df26fcf85602df2e7f65502c7256c1b41735e1122485a3a07ddb580aa83b57f libsndfile-1.0.28.tar.gz
+f98c40696fca3e7bca867df993de55bb4145c23428e65d1a669182eb2293046478ac727ae7f94bb77123ef0355c3c53be4f9d6a432665c90c74687d8d3afd9e3 CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch
+dfd4b5f1c7471fc416eed5c6040580a020543f145de9103751adaad6ce1c5c6a22abc1cf0ffd381aed3072644cd5ee03ba3598265aa7d202d63167da251cb595 CVE-2017-8362.patch"
diff --git a/main/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch b/main/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch
new file mode 100644
index 0000000000..1dc5b57f1d
--- /dev/null
+++ b/main/libsndfile/CVE-2017-8361_CVE-2017-8363_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/main/libsndfile/CVE-2017-8362.patch b/main/libsndfile/CVE-2017-8362.patch
new file mode 100644
index 0000000000..54fbfb44c3
--- /dev/null
+++ b/main/libsndfile/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 ;