diff --git a/sox/trunk/CVE-2017-18189.patch b/sox/trunk/CVE-2017-18189.patch deleted file mode 100644 index 916cb5b3..00000000 --- a/sox/trunk/CVE-2017-18189.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 09d7388c8ad5701ed9c59d1d600ff6154b066397 Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Thu, 9 Nov 2017 11:45:10 +0000 -Subject: [PATCH] xa: validate channel count (CVE-2017-18189) - -A corrupt header specifying zero channels would send read_channels() -into an infinite loop. Prevent this by sanity checking the channel -count in open_read(). Also add an upper bound to prevent overflow -in multiplication. ---- - src/xa.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/xa.c b/src/xa.c -index 81a76772..9fc086ec 100644 ---- a/src/xa.c -+++ b/src/xa.c -@@ -143,6 +143,12 @@ static int startread(sox_format_t * ft) - lsx_report("User options overriding rate read in .xa header"); - } - -+ if (ft->signal.channels == 0 || ft->signal.channels > UINT16_MAX) { -+ lsx_fail_errno(ft, SOX_EFMT, "invalid channel count %d", -+ ft->signal.channels); -+ return SOX_EOF; -+ } -+ - /* Check for supported formats */ - if (ft->encoding.bits_per_sample != 16) { - lsx_fail_errno(ft, SOX_EFMT, "%d-bit sample resolution not supported.", --- -2.22.0 - diff --git a/sox/trunk/CVE-2019-8354.patch b/sox/trunk/CVE-2019-8354.patch deleted file mode 100644 index ba4a0ba2..00000000 --- a/sox/trunk/CVE-2019-8354.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f70911261a84333b077c29908e1242f69d7439eb Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Wed, 24 Apr 2019 14:57:34 +0100 -Subject: [PATCH] fix possible buffer size overflow in lsx_make_lpf() - (CVE-2019-8354) - -The multiplication in the size argument malloc() might overflow, -resulting in a small buffer being allocated. Use calloc() instead. ---- - src/effects_i_dsp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/effects_i_dsp.c b/src/effects_i_dsp.c -index a979b501..e32dfa05 100644 ---- a/src/effects_i_dsp.c -+++ b/src/effects_i_dsp.c -@@ -357,7 +357,7 @@ double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho, - double scale, sox_bool dc_norm) - { - int i, m = num_taps - 1; -- double * h = malloc(num_taps * sizeof(*h)), sum = 0; -+ double * h = calloc(num_taps, sizeof(*h)), sum = 0; - double mult = scale / lsx_bessel_I_0(beta), mult1 = 1 / (.5 * m + rho); - assert(Fc >= 0 && Fc <= 1); - lsx_debug("make_lpf(n=%i Fc=%.7g β=%g ρ=%g dc-norm=%i scale=%g)", num_taps, Fc, beta, rho, dc_norm, scale); --- -2.22.0 - diff --git a/sox/trunk/CVE-2019-8355.patch b/sox/trunk/CVE-2019-8355.patch deleted file mode 100644 index 348a8813..00000000 --- a/sox/trunk/CVE-2019-8355.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f8587e2d50dad72d40453ac1191c539ee9e50381 Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Wed, 24 Apr 2019 17:39:45 +0100 -Subject: [PATCH] fix possible overflow in lsx_(re)valloc() size calculation - (CVE-2019-8355) - ---- - src/Makefile.am | 2 +- - src/xmalloc.c | 10 ++++++++++ - src/xmalloc.h | 5 +++-- - 3 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index 42573ec5..d5f6d125 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -95,7 +95,7 @@ libsox_la_LIBADD += @GOMP_LIBS@ - - libsox_la_CFLAGS = @WARN_CFLAGS@ - libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \ -- -export-symbols-regex '^(sox_.*|lsx_(([cm]|re)alloc|check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|rewind|seeki|sigfigs3p?|strcasecmp|strdup|tell|unreadb|write(b|_b_buf|buf|s)))$$' -+ -export-symbols-regex '^(sox_.*|lsx_(([cm]|re)alloc.*|check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|rewind|seeki|sigfigs3p?|strcasecmp|strdup|tell|unreadb|write(b|_b_buf|buf|s)))$$' - - if HAVE_WIN32_LTDL - libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h -diff --git a/src/xmalloc.c b/src/xmalloc.c -index 56fe6944..72c9ea4d 100644 ---- a/src/xmalloc.c -+++ b/src/xmalloc.c -@@ -57,6 +57,16 @@ void *lsx_calloc(size_t n, size_t size) - return lsx_checkptr(calloc(n + !n, size + !size)); - } - -+void *lsx_realloc_array(void *p, size_t n, size_t size) -+{ -+ if (n > (size_t)-1 / size) { -+ lsx_fail("malloc size overflow"); -+ exit(2); -+ } -+ -+ return lsx_realloc(p, n * size); -+} -+ - char *lsx_strdup(const char *s) - { - return lsx_checkptr(strdup(s)); -diff --git a/src/xmalloc.h b/src/xmalloc.h -index 92ac64d9..21ff6630 100644 ---- a/src/xmalloc.h -+++ b/src/xmalloc.h -@@ -25,11 +25,12 @@ - - LSX_RETURN_VALID void *lsx_malloc(size_t size); - LSX_RETURN_VALID void *lsx_calloc(size_t n, size_t size); -+LSX_RETURN_VALID void *lsx_realloc_array(void *p, size_t n, size_t size); - LSX_RETURN_VALID char *lsx_strdup(const char *s); - - #define lsx_Calloc(v,n) v = lsx_calloc(n,sizeof(*(v))) - #define lsx_memdup(p,s) ((p)? memcpy(lsx_malloc(s), p, s) : NULL) --#define lsx_valloc(v,n) v = lsx_malloc((n)*sizeof(*(v))) --#define lsx_revalloc(v,n) v = lsx_realloc(v, (n)*sizeof(*(v))) -+#define lsx_valloc(v,n) v = lsx_realloc_array(NULL, n, sizeof(*(v))) -+#define lsx_revalloc(v,n) v = lsx_realloc_array(v, n, sizeof(*(v))) - - #endif --- -2.22.0 - diff --git a/sox/trunk/CVE-2019-8356.patch b/sox/trunk/CVE-2019-8356.patch deleted file mode 100644 index 60dc1ae4..00000000 --- a/sox/trunk/CVE-2019-8356.patch +++ /dev/null @@ -1,92 +0,0 @@ -From b7883ae1398499daaa926ae6621f088f0f531ed8 Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Wed, 24 Apr 2019 16:56:42 +0100 -Subject: [PATCH] fft4g: bail if size too large (CVE-2019-8356) - -Prevent overflowing of fixed-size buffers in bitrv2() and bitrv2conj() -if the transform size is too large. ---- - src/fft4g.c | 18 ++++++++++++++++++ - src/fft4g.h | 2 ++ - 2 files changed, 20 insertions(+) - -diff --git a/src/fft4g.c b/src/fft4g.c -index 38a8bcc0..88a2a7ec 100644 ---- a/src/fft4g.c -+++ b/src/fft4g.c -@@ -322,6 +322,9 @@ static void rftfsub(int n, double *a, int nc, double const *c); - - void cdft(int n, int isgn, double *a, int *ip, double *w) - { -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - if (n > (ip[0] << 2)) { - makewt(n >> 2, ip, w); - } -@@ -344,6 +347,9 @@ void rdft(int n, int isgn, double *a, int *ip, double *w) - int nw, nc; - double xi; - -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - nw = ip[0]; - if (n > (nw << 2)) { - nw = n >> 2; -@@ -384,6 +390,9 @@ void ddct(int n, int isgn, double *a, int *ip, double *w) - int j, nw, nc; - double xr; - -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - nw = ip[0]; - if (n > (nw << 2)) { - nw = n >> 2; -@@ -435,6 +444,9 @@ void ddst(int n, int isgn, double *a, int *ip, double *w) - int j, nw, nc; - double xr; - -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - nw = ip[0]; - if (n > (nw << 2)) { - nw = n >> 2; -@@ -486,6 +498,9 @@ void dfct(int n, double *a, double *t, int *ip, double *w) - int j, k, l, m, mh, nw, nc; - double xr, xi, yr, yi; - -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - nw = ip[0]; - if (n > (nw << 3)) { - nw = n >> 3; -@@ -576,6 +591,9 @@ void dfst(int n, double *a, double *t, int *ip, double *w) - int j, k, l, m, mh, nw, nc; - double xr, xi, yr, yi; - -+ if (n > FFT4G_MAX_SIZE) -+ return; -+ - nw = ip[0]; - if (n > (nw << 3)) { - nw = n >> 3; -diff --git a/src/fft4g.h b/src/fft4g.h -index 2b8051ca..95ee3413 100644 ---- a/src/fft4g.h -+++ b/src/fft4g.h -@@ -13,6 +13,8 @@ - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -+#define FFT4G_MAX_SIZE 262144 -+ - void lsx_cdft(int, int, double *, int *, double *); - void lsx_rdft(int, int, double *, int *, double *); - void lsx_ddct(int, int, double *, int *, double *); --- -2.22.0 - diff --git a/sox/trunk/CVE-2019-8357.patch b/sox/trunk/CVE-2019-8357.patch deleted file mode 100644 index 062c8203..00000000 --- a/sox/trunk/CVE-2019-8357.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2ce02fea7b350de9ddfbcf542ba4dd59a8ab255b Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Wed, 24 Apr 2019 15:08:51 +0100 -Subject: [PATCH] fix possible null pointer deref in lsx_make_lpf() - (CVE-2019-8357) - -If the buffer allocation fails, return NULL. ---- - src/effects_i_dsp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/effects_i_dsp.c b/src/effects_i_dsp.c -index e32dfa05..88b1b390 100644 ---- a/src/effects_i_dsp.c -+++ b/src/effects_i_dsp.c -@@ -362,6 +362,9 @@ double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho, - assert(Fc >= 0 && Fc <= 1); - lsx_debug("make_lpf(n=%i Fc=%.7g β=%g ρ=%g dc-norm=%i scale=%g)", num_taps, Fc, beta, rho, dc_norm, scale); - -+ if (!h) -+ return NULL; -+ - for (i = 0; i <= m / 2; ++i) { - double z = i - .5 * m, x = z * M_PI, y = z * mult1; - h[i] = x? sin(Fc * x) / x : Fc; --- -2.22.0 - diff --git a/sox/trunk/PKGBUILD b/sox/trunk/PKGBUILD index a827538d..b5a4f6fb 100644 --- a/sox/trunk/PKGBUILD +++ b/sox/trunk/PKGBUILD @@ -2,14 +2,15 @@ # Contributor: Eric Bélanger pkgname=sox +# using a git snapshot as 14.4.2 has many unfixed security vulns pkgver=14.4.2 -pkgrel=7 +pkgrel=8 pkgdesc="The Swiss Army knife of sound processing tools" arch=('x86_64') url="http://sox.sourceforge.net/" license=('GPL2' 'LGPL2.1') depends=('libltdl' 'file' 'libsndfile' 'libpng' 'lame' 'opencore-amr' 'gsm') -makedepends=('libao' 'libmad' 'libid3tag' 'wavpack' 'libpulse' 'opusfile' 'twolame') +makedepends=('autoconf-archive' 'libao' 'libmad' 'libid3tag' 'wavpack' 'libpulse' 'opusfile' 'twolame') checkdepends=('time') optdepends=('libao: for ao plugin' 'libmad: for mp3 plugin' @@ -18,68 +19,19 @@ optdepends=('libao: for ao plugin' 'libpulse: for pulse plugin' 'opusfile: for opus plugin' 'twolame: for mp3 plugin') -source=("https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2" - CVE-2017-15371.patch::https://github.com/mansr/sox/commit/818bdd0.patch - CVE-2017-11358.patch::https://github.com/mansr/sox/commit/6cb44a4.patch - CVE-2017-15370.patch::https://github.com/mansr/sox/commit/ef3d8be.patch - CVE-2017-11332.patch::https://github.com/mansr/sox/commit/7405bca.patch - CVE-2017-11359.patch::https://github.com/mansr/sox/commit/8b590b3.patch - CVE-2017-15372.patch::https://github.com/mansr/sox/commit/001c337.patch - CVE-2017-15642.patch::https://github.com/mansr/sox/commit/0be259e.patch - CVE-2017-18189.patch - update-exported-symbol-list.patch - add-destdir.patch - cleanup-lsx_malloc.patch - CVE-2019-8354.patch - CVE-2019-8355.patch - CVE-2019-8356.patch - CVE-2019-8357.patch) - -sha512sums=('424b80e9fff43864b0581fea7a231b8308bdebb2aee0b97cc40eeaa347c093e94bcd0111e8b431e7bfe88b3c1133660ede42b6b49d14555ea0626c2c0ffa308e' - '9f61fc979d0e0232aa2004a455a139950ceb998338577b94cd3bebfdf230896bde9765f9afef1af515ae0679b3afd245142027de3b7ce87eced3fbdb86558668' - 'b2a096659cc98bd50322441d3611e607b71c54025feaf7c2acc322fff8c0ef5a83f06bef31099c4adf1794009b050a3f2dca71c7926892c60081261384891ac4' - 'e5c079f8e8e4603e068a092db86ec6dea4da395f75fb4bfa284736edce2d8ea3441deda51ca7dce8865e1ac5914cdf9c6767ed74203726f26992e9d76f4d8b0b' - '8c26bea077b503c8ec420880539f2a6e275d2b3c26eb5b4c5af38aae16b258a29ceb946aeb2252e47aeea22e5b6513c628a7ee3eb3d201d6fa541456b16bd399' - '6fb075c09cfedaec6bb6760ba2e0d55446478c8e2873884b6a940d42f44ad8e840809f8b31b59ff3d40307dd48d74dadf809859dfef190269da8800185b462a6' - 'b1936686a7dff2b42629d05cb59cfdb86c2a42ef843fe0cd031607d1c7174479ed8cfc0d5c6ffd3be80c9c20894dd919547e8bd861ed5b49d596ee89a19db372' - 'e44a2327a8808bf94acb8db1d8ea13f77bbe0600be47079b7c77dab3daab44a67c3ca9be93b32db6807c2c96c6b67529884d38bf03d02dda6be04794e711cb71' - 'a47f29cf6d6fce3143dbd905fed8eb50509294311ec7d66970331b1b5fc83858c620e968579decfa781c5074028994bf4a4a1aa978b12bb271b7d10247ca58ec' - '0d6e244fad2cb01df9a773870db01ad0f82c0e04cfc3bbf62d2c85121841d7eebd4dad94d84cab0368607caea7ec3285933f76cfb886cadd99248ccf38160f66' - 'db12f05db67c2c70aa28c1ea0b5b5b049e947487e2e6debda9545f98ef53827af968c6a3728aac046d17b431600b5a83569eb6c34959948e33bec2657a4342c1' - 'a343519674390c8188f10b156ba66267872ac5128a4f88ea3aef9afd61492df8372859e50c4842e511ce13000df1d3977d503fde06a428c2a7c1c8047ad7a57e' - '244127ec701c01f3834887414177c1d6fcc7d96e88ee5b862f3bcdd4af9c38028bc886caf7ada4ba0331f6c288c650b40736ed866850c2c6506b5238f04089c3' - 'fad274e93f65089e4c704e5a7438377e0e25b7fb457fb2801ca8a7179fe57519d0b11cc90c9ca25271a5eecf7b0ebd372a6ea035b9315b555d5e7ebcf5d775a7' - '8bc3fe9800a878bd9920937321dd75f0a19328dd6dcc88bba9c30e7ac12b2ba3a1d53f0e8e3ee3e0bbd42e953590f2e96c3c64e287b58c646bacbc69362917fa' - 'ede53032a7c6288b0bcc7f5766540b4b8dcb5f5dcf65de8cdcfac632a60d940ef22119567649bf6213ed551910f8744601b655e1b4104e4ca259bf47358757b0') +_commit=("42b3557e13e0fe01a83465b672d89faddbe65f49") +source=("https://sourceforge.net/code-snapshots/git/s/so/sox/code.git/sox-code-${_commit}.zip") +sha512sums=('4868f9b77141b7e2caf2571ceb68a48bd744732e72f63ed787f8e0b9fe39b77de4e998b32d99c2500e10b017a1fd1a3379f4f9f8b67db6093b85d02cb3447934') prepare() { - cd ${pkgname}-${pkgver} - # fix man page installation - sed -e 's|man1/sox.1 soxeffect.7|man1/sox.1.gz soxeffect.7.gz|' \ - -i Makefile.in - - # patch all (known) CVEs from 2017 - for _cve in 15371 11358 15370 11332 11359 15372 15642 18189; do - patch -Np1 -i ../CVE-2017-$_cve.patch - done - - # applying patches required to apply CVE patches cleanly - patch -Np1 -i ../add-destdir.patch - patch -Np1 -i ../update-exported-symbol-list.patch - patch -Np1 -i ../cleanup-lsx_malloc.patch - - # patch all (known) CVEs from 2019 - for _cve in 8354 8355 8356 8357; do - patch -p1 -i ../CVE-2019-$_cve.patch - done - - # test fails with CVE-2017-11359.patch - sed -e '/hcom/d' -i src/tests.sh + cd sox-code-${_commit} + # don't overwrite cflags + sed -i -e 's:CFLAGS="-g":CFLAGS="$CFLAGS -g":' configure.ac autoreconf -vfi } build() { - cd ${pkgname}-${pkgver} + cd sox-code-${_commit} ./configure --prefix=/usr \ --sysconfdir=/etc \ --with-dyn-default \ @@ -88,13 +40,13 @@ build() { } check() { - cd ${pkgname}-${pkgver} + cd sox-code-${_commit} make bindir=. installcheck } package() { - cd ${pkgname}-${pkgver} + cd sox-code-${_commit} make DESTDIR="${pkgdir}" install - install -vDm 644 {AUTHORS,ChangeLog,README} \ + install -vDm 644 {AUTHORS,ChangeLog} \ -t "${pkgdir}/usr/share/doc/${pkgname}" } diff --git a/sox/trunk/add-destdir.patch b/sox/trunk/add-destdir.patch deleted file mode 100644 index 21344e7d..00000000 --- a/sox/trunk/add-destdir.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0d70a21c6f98575984c28f4e98a1fbf929195456 Mon Sep 17 00:00:00 2001 -From: Jiri Kucera -Date: Thu, 25 Jan 2018 21:53:30 +0100 -Subject: [PATCH] make: add $(DESTDIR) in installcheck target [bug #302] - -This ensures the proper sox binary is invoked during tests. ---- - src/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index 7cceaafd..caf98645 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -194,6 +194,6 @@ loc: - # would run the test suite, but an uninstalled libltdl build cannot - # currently load its formats and effects, so the checks would fail. - installcheck: -- $(srcdir)/tests.sh --bindir=${bindir} --builddir=${builddir} --srcdir=${srcdir} -- $(srcdir)/testall.sh --bindir=${bindir} --srcdir=${srcdir} -+ $(srcdir)/tests.sh --bindir=$(DESTDIR)${bindir} --builddir=${builddir} --srcdir=${srcdir} -+ $(srcdir)/testall.sh --bindir=$(DESTDIR)${bindir} --srcdir=${srcdir} - --- -2.22.0 - diff --git a/sox/trunk/cleanup-lsx_malloc.patch b/sox/trunk/cleanup-lsx_malloc.patch deleted file mode 100644 index bde521df..00000000 --- a/sox/trunk/cleanup-lsx_malloc.patch +++ /dev/null @@ -1,93 +0,0 @@ -From ccedd08802f62ed896f69d778e6a106d00f9ab58 Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Tue, 8 Dec 2015 22:52:41 +0000 -Subject: [PATCH] Clean up lsx_malloc() and friends - ---- - src/Makefile.am | 2 +- - src/xmalloc.c | 30 +++++++++++++++++++++++++----- - src/xmalloc.h | 7 ++++--- - 3 files changed, 30 insertions(+), 9 deletions(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index cd44ae4d..42573ec5 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -95,7 +95,7 @@ libsox_la_LIBADD += @GOMP_LIBS@ - - libsox_la_CFLAGS = @WARN_CFLAGS@ - libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \ -- -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$' -+ -export-symbols-regex '^(sox_.*|lsx_(([cm]|re)alloc|check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|rewind|seeki|sigfigs3p?|strcasecmp|strdup|tell|unreadb|write(b|_b_buf|buf|s)))$$' - - if HAVE_WIN32_LTDL - libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h -diff --git a/src/xmalloc.c b/src/xmalloc.c -index 9bf15969..56fe6944 100644 ---- a/src/xmalloc.c -+++ b/src/xmalloc.c -@@ -20,6 +20,16 @@ - #include "sox_i.h" - #include - -+static void *lsx_checkptr(void *ptr) -+{ -+ if (!ptr) { -+ lsx_fail("out of memory"); -+ exit(2); -+ } -+ -+ return ptr; -+} -+ - /* Resize an allocated memory area; abort if not possible. - * - * For malloc, `If the size of the space requested is zero, the behavior is -@@ -34,10 +44,20 @@ void *lsx_realloc(void *ptr, size_t newsize) - return NULL; - } - -- if ((ptr = realloc(ptr, newsize)) == NULL) { -- lsx_fail("out of memory"); -- exit(2); -- } -+ return lsx_checkptr(realloc(ptr, newsize)); -+} -+ -+void *lsx_malloc(size_t size) -+{ -+ return lsx_checkptr(malloc(size + !size)); -+} -+ -+void *lsx_calloc(size_t n, size_t size) -+{ -+ return lsx_checkptr(calloc(n + !n, size + !size)); -+} - -- return ptr; -+char *lsx_strdup(const char *s) -+{ -+ return lsx_checkptr(strdup(s)); - } -diff --git a/src/xmalloc.h b/src/xmalloc.h -index 9ee77f63..92ac64d9 100644 ---- a/src/xmalloc.h -+++ b/src/xmalloc.h -@@ -23,10 +23,11 @@ - #include - #include - --#define lsx_malloc(size) lsx_realloc(NULL, (size)) --#define lsx_calloc(n,s) (((n)*(s))? memset(lsx_malloc((n)*(s)),0,(n)*(s)) : NULL) -+LSX_RETURN_VALID void *lsx_malloc(size_t size); -+LSX_RETURN_VALID void *lsx_calloc(size_t n, size_t size); -+LSX_RETURN_VALID char *lsx_strdup(const char *s); -+ - #define lsx_Calloc(v,n) v = lsx_calloc(n,sizeof(*(v))) --#define lsx_strdup(p) ((p)? strcpy((char *)lsx_malloc(strlen(p) + 1), p) : NULL) - #define lsx_memdup(p,s) ((p)? memcpy(lsx_malloc(s), p, s) : NULL) - #define lsx_valloc(v,n) v = lsx_malloc((n)*sizeof(*(v))) - #define lsx_revalloc(v,n) v = lsx_realloc(v, (n)*sizeof(*(v))) --- -2.22.0 - diff --git a/sox/trunk/update-exported-symbol-list.patch b/sox/trunk/update-exported-symbol-list.patch deleted file mode 100644 index 3ae0b5ec..00000000 --- a/sox/trunk/update-exported-symbol-list.patch +++ /dev/null @@ -1,25 +0,0 @@ -From ec073861aa9c0f779a3741c456e4f97d59366ffb Mon Sep 17 00:00:00 2001 -From: Mans Rullgard -Date: Sun, 5 Nov 2017 15:40:16 +0000 -Subject: [PATCH] make: update exported symbol list [bug #266] - ---- - src/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index caf98645..cd44ae4d 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -95,7 +95,7 @@ libsox_la_LIBADD += @GOMP_LIBS@ - - libsox_la_CFLAGS = @WARN_CFLAGS@ - libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \ -- -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$' -+ -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$' - - if HAVE_WIN32_LTDL - libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h --- -2.22.0 -