diff options
author | Zach van Rijn <me@zv.io> | 2022-11-12 01:02:19 +0000 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2024-08-10 06:09:35 +0000 |
commit | 162df969cb49a199180892d3e6f2827a92e4a6aa (patch) | |
tree | cd531161a911e0037e2df70497150142d64a49af | |
parent | 6f94d419b70e2881ce6d9c37233b5a13dca61d08 (diff) | |
download | packages-zv/libsndfile.tar.gz packages-zv/libsndfile.tar.bz2 packages-zv/libsndfile.tar.xz packages-zv/libsndfile.zip |
[WIP] user/libsndfile: bump { 1.0.28 --> 1.1.0 }. fixes #127.zv/libsndfile
-rw-r--r-- | user/libsndfile/APKBUILD | 61 | ||||
-rw-r--r-- | user/libsndfile/CVE-2017-12562.patch | 88 | ||||
-rw-r--r-- | user/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch | 64 | ||||
-rw-r--r-- | user/libsndfile/CVE-2017-8362.patch | 50 | ||||
-rw-r--r-- | user/libsndfile/varargs-32bit.patch | 11 |
5 files changed, 35 insertions, 239 deletions
diff --git a/user/libsndfile/APKBUILD b/user/libsndfile/APKBUILD index 25843869c..fc6b77f6a 100644 --- a/user/libsndfile/APKBUILD +++ b/user/libsndfile/APKBUILD @@ -1,22 +1,16 @@ # Contributor: Sergey Lukin <sergej.lukin@gmail.com> # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=libsndfile -pkgver=1.0.28 -pkgrel=4 +pkgver=1.1.0 +pkgrel=0 pkgdesc="Library for reading and writing sampled sound files (WAV, AIFF, ...)" -url="http://www.mega-nerd.com/libsndfile" +url="https://libsndfile.github.io/libsndfile/" arch="all" license="LGPL-2.1-only OR LGPL-3.0-only" subpackages="$pkgname-dev $pkgname-doc" depends="" -depends_dev="flac-dev libogg-dev libvorbis-dev" -makedepends="$depends_dev alsa-lib-dev linux-headers" -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 - CVE-2017-12562.patch - varargs-32bit.patch - " +makedepends="alsa-lib-dev flac-dev libogg-dev libvorbis-dev linux-headers opus-dev python3 cmake" +source="https://github.com/libsndfile/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.xz" # secfixes: # 1.0.28-r2: @@ -32,26 +26,41 @@ source="http://www.mega-nerd.com/$pkgname/files/$pkgname-$pkgver.tar.gz # - CVE-2017-8365 build() { - ac_cv_sys_largefile_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \ - ./configure \ - --build=$CBUILD \ - --host=$CHOST \ - --prefix=/usr \ - --disable-sqlite \ - --enable-largefile - make + cmake -B build-shared \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=True \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DENABLE_MPEG=OFF \ + -DBUILD_REGTEST=OFF \ + -DBUILD_TESTING=OFF + make -C build-shared + + # required for testing + cmake -B build-static \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=False \ + -DCMAKE_BUILD_TYPE=RelWithDebugInfo \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + -DENABLE_MPEG=OFF \ + -DBUILD_REGTEST=OFF \ + -DBUILD_TESTING=ON + make -C build-static } check() { - make check + cd build-static + # the failed 'wrt_32bit.sd2' test is not a new regression + CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E '(write_read_test_sd2)' } package() { - make DESTDIR="$pkgdir" install + make -C build-shared DESTDIR="$pkgdir" install + make -C build-static DESTDIR="$pkgdir" install } -sha512sums="890731a6b8173f714155ce05eaf6d991b31632c8ab207fbae860968861a107552df26fcf85602df2e7f65502c7256c1b41735e1122485a3a07ddb580aa83b57f libsndfile-1.0.28.tar.gz -f98c40696fca3e7bca867df993de55bb4145c23428e65d1a669182eb2293046478ac727ae7f94bb77123ef0355c3c53be4f9d6a432665c90c74687d8d3afd9e3 CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch -dfd4b5f1c7471fc416eed5c6040580a020543f145de9103751adaad6ce1c5c6a22abc1cf0ffd381aed3072644cd5ee03ba3598265aa7d202d63167da251cb595 CVE-2017-8362.patch -814139567d90fb07908014e858c341fe933e04dca69b88ad66078910888237bbeba94f85d9e1489883c424f35fca312eb98c21ae2b122d9289bb6418725cd02e CVE-2017-12562.patch -2b83bacec23665cd31a596a1ce1fb543f935c7609dfff93a85822f81d66b3483cd547cd043eefb901d543276c270a17add70bf0db6348b5279220a7ecbd8b339 varargs-32bit.patch" +sha512sums="d01696a8a88a4444e5eb91a137cf7b26b55b12c1fe3b648653f7e78674bbdf61870066216c9ff2f6a1e63bdf7b558af9a759480cf6523b607d29347b12762006 libsndfile-1.1.0.tar.xz" diff --git a/user/libsndfile/CVE-2017-12562.patch b/user/libsndfile/CVE-2017-12562.patch deleted file mode 100644 index f195e87e4..000000000 --- a/user/libsndfile/CVE-2017-12562.patch +++ /dev/null @@ -1,88 +0,0 @@ -From cf7a8182c2642c50f1cf90dddea9ce96a8bad2e8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= <osmanx@problemloesungsmaschine.de> -Date: Wed, 14 Jun 2017 12:25:40 +0200 -Subject: [PATCH] src/common.c: Fix heap buffer overflows when writing strings - in binheader - -Fixes the following problems: - 1. Case 's' only enlarges the buffer by 16 bytes instead of size bytes. - 2. psf_binheader_writef() enlarges the header buffer (if needed) prior to the - big switch statement by an amount (16 bytes) which is enough for all cases - where only a single value gets added. Cases 's', 'S', 'p' however - additionally write an arbitrary length block of data and again enlarge the - buffer to the required amount. However, the required space calculation does - not take into account the size of the length field which gets output before - the data. - 3. Buffer size requirement calculation in case 'S' does not account for the - padding byte ("size += (size & 1) ;" happens after the calculation which - uses "size"). - 4. Case 'S' can overrun the header buffer by 1 byte when no padding is - involved - ("memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + 1) ;" while - the buffer is only guaranteed to have "size" space available). - 5. "psf->header.ptr [psf->header.indx] = 0 ;" in case 'S' always writes 1 byte - beyond the space which is guaranteed to be allocated in the header buffer. - 6. Case 's' can overrun the provided source string by 1 byte if padding is - involved ("memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;" - where "size" is "strlen (strptr) + 1" (which includes the 0 terminator, - plus optionally another 1 which is padding and not guaranteed to be - readable via the source string pointer). - -Closes: https://github.com/erikd/libsndfile/issues/292 ---- - src/common.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/src/common.c b/src/common.c -index 1a6204ca..6b2a2ee9 100644 ---- a/src/common.c -+++ b/src/common.c -@@ -681,16 +681,16 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) - /* Write a C string (guaranteed to have a zero terminator). */ - strptr = va_arg (argptr, char *) ; - size = strlen (strptr) + 1 ; -- size += (size & 1) ; - -- if (psf->header.indx + (sf_count_t) size >= psf->header.len && psf_bump_header_allocation (psf, 16)) -+ if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1))) - return count ; - - if (psf->rwf_endian == SF_ENDIAN_BIG) -- header_put_be_int (psf, size) ; -+ header_put_be_int (psf, size + (size & 1)) ; - else -- header_put_le_int (psf, size) ; -+ header_put_le_int (psf, size + (size & 1)) ; - memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ; -+ size += (size & 1) ; - psf->header.indx += size ; - psf->header.ptr [psf->header.indx - 1] = 0 ; - count += 4 + size ; -@@ -703,16 +703,15 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) - */ - strptr = va_arg (argptr, char *) ; - size = strlen (strptr) ; -- if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size)) -+ if (psf->header.indx + 4 + (sf_count_t) size + (sf_count_t) (size & 1) > psf->header.len && psf_bump_header_allocation (psf, 4 + size + (size & 1))) - return count ; - if (psf->rwf_endian == SF_ENDIAN_BIG) - header_put_be_int (psf, size) ; - else - header_put_le_int (psf, size) ; -- memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + 1) ; -+ memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size + (size & 1)) ; - size += (size & 1) ; - psf->header.indx += size ; -- psf->header.ptr [psf->header.indx] = 0 ; - count += 4 + size ; - break ; - -@@ -724,7 +723,7 @@ psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) - size = (size & 1) ? size : size + 1 ; - size = (size > 254) ? 254 : size ; - -- if (psf->header.indx + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, size)) -+ if (psf->header.indx + 1 + (sf_count_t) size > psf->header.len && psf_bump_header_allocation (psf, 1 + size)) - return count ; - - header_put_byte (psf, size) ; diff --git a/user/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch b/user/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch deleted file mode 100644 index 1dc5b57f1..000000000 --- a/user/libsndfile/CVE-2017-8361_CVE-2017-8363_CVE-2017-8365.patch +++ /dev/null @@ -1,64 +0,0 @@ -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/user/libsndfile/CVE-2017-8362.patch b/user/libsndfile/CVE-2017-8362.patch deleted file mode 100644 index 54fbfb44c..000000000 --- a/user/libsndfile/CVE-2017-8362.patch +++ /dev/null @@ -1,50 +0,0 @@ -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/user/libsndfile/varargs-32bit.patch b/user/libsndfile/varargs-32bit.patch deleted file mode 100644 index 81f149add..000000000 --- a/user/libsndfile/varargs-32bit.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libsndfile-1.0.28/src/rf64.c.old 2017-04-02 02:43:22.000000000 -0500 -+++ libsndfile-1.0.28/src/rf64.c 2018-03-04 22:35:31.072461118 -0600 -@@ -737,7 +737,7 @@ - - pad_size = psf->dataoffset - 16 - psf->header.indx ; - if (pad_size >= 0) -- psf_binheader_writef (psf, "m4z", PAD_MARKER, pad_size, make_size_t (pad_size)) ; -+ psf_binheader_writef (psf, "m4z", PAD_MARKER, (unsigned int) pad_size, make_size_t (pad_size)) ; - - if (wpriv->rf64_downgrade && (psf->filelength < RIFF_DOWNGRADE_BYTES)) - psf_binheader_writef (psf, "tm8", data_MARKER, psf->datalength) ; |