Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
From a1c913c52f70ee7c70e1e5ae1473ee407cd1494c Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Sat, 17 May 2025 22:12:23 +0200
Subject: [PATCH] Make SoX support uclibc-based toolchains
From http://sourceforge.net/p/sox/bugs/179/
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
[Julien: rebased patch on package git version 7524160,
and regenerated with git format-patch]
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
src/formats.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/formats.c b/src/formats.c
index 3fcf4382..9fc001bd 100644
--- a/src/formats.c
+++ b/src/formats.c
@@ -466,7 +466,7 @@ static void UNUSED rewind_pipe(FILE * fp)
#if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__
fp->_p -= PIPE_AUTO_DETECT_SIZE;
fp->_r += PIPE_AUTO_DETECT_SIZE;
-#elif defined __GLIBC__
+#elif defined __GLIBC__ && ! defined __UCLIBC__
fp->_IO_read_ptr = fp->_IO_read_base;
#elif defined _MSC_VER && _MSC_VER >= 1900
#define NO_REWIND_PIPE
@@ -477,7 +477,6 @@ static void UNUSED rewind_pipe(FILE * fp)
/* To fix this #error, either simply remove the #error line and live without
* file-type detection with pipes, or add support for your compiler in the
* lines above. Test with cat monkey.wav | ./sox --info - */
- #error FIX NEEDED HERE
#define NO_REWIND_PIPE
(void)fp;
#endif
--
2.49.0

View File

@@ -0,0 +1,45 @@
From 18ace560a15207503805d4df25b90c7a756bcbf6 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Tue, 2 Feb 2021 23:53:39 +0100
Subject: [PATCH] configure.ac: put back --disable-stack-protector
Put back --disable-stack-protector which has been removed by commit
70c85915eace83142b84e4f65f5db421cf0c09e3. This will allow the user to
disable it or to let a higher buildsystem such as buildroot to finely
configure it.
Indeed, without this patch, build can fail as some compilers (such as
uclibc) could missed the needed library (-lssp or -lssp_nonshared) at
linking step:
CCLD libsox.la
/home/fabrice/br-test-pkg/br-arm-full/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.5.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lssp_nonshared
/home/fabrice/br-test-pkg/br-arm-full/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/5.5.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find -lssp
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: https://sourceforge.net/p/sox/patches/122/]
---
configure.ac | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 39306398..a1665467 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,12 @@ AC_PROG_LN_S
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
-AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
+AC_ARG_ENABLE([stack-protector],
+ AS_HELP_STRING([--disable-stack-protector], [Disable -fstack-protector-strong]),
+ [enable_stack_protector=$enableval], [enable_stack_protector=yes])
+AS_IF([test x"$enable_stack_protector" = "xyes"],
+ [AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])])
+
AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-prototypes -Wstrict-prototypes])
AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
--
2.29.2

View File

@@ -0,0 +1,49 @@
From 06e5cc069dbdfa060c3d9e75a798ec121ecc9349 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 6 Feb 2021 11:08:45 +0100
Subject: [PATCH] configure.ac: fix static linking with id3tag
Put back -lz (i.e. ZLIB_LIBS) when searching for id3tag which was
wrongly removed by commit 6ff0e9322f9891f5a6ac6c9b3bceffbfca16bec3. This
will fix the following static build failure:
configure:15290: checking for id3_file_open in -lid3tag
configure:15315: /home/buildroot/autobuild/instance-0/output-1/host/bin/arm-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -static -Wall -Wmissing-prototypes -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -Wl,--as-needed conftest.c -lid3tag >&5
conftest.c:60:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
60 | char id3_file_open ();
| ^~~~
conftest.c:62:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
62 | main ()
| ^~~~
/home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libid3tag.a(util.o): in function `id3_util_compress':
util.c:(.text+0x1ac): undefined reference to `compress2'
/home/buildroot/autobuild/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /home/buildroot/autobuild/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libid3tag.a(util.o): in function `id3_util_decompress':
util.c:(.text+0x240): undefined reference to `uncompress'
Fixes:
- http://autobuild.buildroot.org/results/73efdacf237e3d567fa66f3b3f68e624f5e35bc7
Signed-off-by: Julien Olivain <ju.o@free.fr>
[Julien: rebased patch on package git version 7524160]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: https://sourceforge.net/p/sox/patches/123]
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index a1665467..8f47a978 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ dnl Various libraries
SOX_WITH_LIB([magic], [magic.h], [magic], [magic_open])
SOX_CHECK_LIB([ZLIB], [zlib.h], [z], [uncompress])
SOX_WITH_LIB([png], [png.h], [png], [png_set_rows], [], [], [], [$ZLIB_LIBS])
-SOX_WITH_LIB([id3tag], [id3tag.h], [id3tag], [id3_file_open])
+SOX_WITH_LIB([id3tag], [id3tag.h], [id3tag], [id3_file_open], [], [], [], [$ZLIB_LIBS])
SOX_WITH_LIB([libgsm], [gsm/gsm.h gsm.h], [gsm], [gsm_create])
dnl Optional formats
--
2.45.2

View File

@@ -0,0 +1,50 @@
From 76b78cb89cf8fc36b4ced568f3b34f778df53411 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 3 Mar 2021 16:48:57 +0100
Subject: [PATCH] configure.ac: fix static linking with magic
Use SOX_FMT_PKG to retrieve magic dependencies (e.g. bzip2 or zlib)
indeed -lz (i.e. ZLIB_LIBS) was wrongly removed by commit
6ff0e9322f9891f5a6ac6c9b3bceffbfca16bec3. This will fix the following
static build failure:
configure:11677: checking for magic_open in -lmagic
configure:11702: /srv/storage/autobuild/run/instance-0/output-1/host/bin/arm-linux-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -Wall -Wmissing-prototypes -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -Wl,--as-needed conftest.c -lmagic >&5
conftest.c:53:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
53 | char magic_open ();
| ^~~~
conftest.c:55:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
55 | main ()
| ^~~~
/srv/storage/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: /srv/storage/autobuild/run/instance-0/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libmagic.a(compress.o): in function `uncompresszlib':
compress.c:(.text+0x1d0): undefined reference to `inflateInit_'
/srv/storage/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x1e4): undefined reference to `inflate'
/srv/storage/autobuild/run/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/9.3.0/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: compress.c:(.text+0x1fc): undefined reference to `inflateEnd'
Fixes:
- http://autobuild.buildroot.org/results/d96f27cd96926060046e2e1115777f5bceda3741
Signed-off-by: Julien Olivain <ju.o@free.fr>
[Julien: rebased patch on package git version 7524160]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: not sent yet (waiting for feedback on third patch)]
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 8f47a978..20454ed5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,7 @@ SOX_REPORT([other], [LADSPA effect plugins], [$HAVE_LADSPA])
dnl Various libraries
-SOX_WITH_LIB([magic], [magic.h], [magic], [magic_open])
+SOX_FMT_PKG([magic], [libmagic])
SOX_CHECK_LIB([ZLIB], [zlib.h], [z], [uncompress])
SOX_WITH_LIB([png], [png.h], [png], [png_set_rows], [], [], [], [$ZLIB_LIBS])
SOX_WITH_LIB([id3tag], [id3tag.h], [id3tag], [id3_file_open], [], [], [], [$ZLIB_LIBS])
--
2.45.2

View File

@@ -0,0 +1,46 @@
From 7a2e270989037663e740487a8248db1227697c92 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Wed, 4 Aug 2021 10:27:16 +0200
Subject: [PATCH] configure.ac: fix static linking with sndfile
Use SOX_FMT_PKG to retrieve sndfile dependencies (e.g. flac, opus or
vorbis). This will fix the following static build failure:
configure:14720: checking for sf_open_virtual in -lsndfile
configure:14745: /tmp/instance-1/output-1/host/bin/xtensa-buildroot-linux-uclibc-gcc -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -mlongcalls -mauto-litpools -Os -g0 -static -Wall -Wmissing-prototypes -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -static -Wl,--as-needed conftest.c -lsndfile >&5
conftest.c:73:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
73 | char sf_open_virtual ();
| ^~~~
conftest.c:75:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
75 | main ()
| ^~~~
/tmp/instance-1/output-1/host/lib/gcc/xtensa-buildroot-linux-uclibc/10.3.0/../../../../xtensa-buildroot-linux-uclibc/bin/ld: /tmp/instance-1/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/lib/libsndfile.a(libsndfile_la-flac.o): in function `flac_byterate':
flac.c:(.text+0xfc): undefined reference to `FLAC__StreamDecoderErrorStatusString'
Fixes:
- http://autobuild.buildroot.org/results/4bc58ed68b29642876bb02710d0cd4f31540de86
Signed-off-by: Julien Olivain <ju.o@free.fr>
[Julien: rebased patch on package git version 7524160]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: not sent yet (waiting for feedback on third patch)]
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 20454ed5..4330360b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,7 +122,7 @@ SOX_FMT_REQ([mp3], [MAD LAME TWOLAME])
SOX_FMT_PKG([oggvorbis], [ogg vorbis vorbisenc vorbisfile])
SOX_FMT_PKG([opus], [opusfile])
-SOX_DL_LIB([libsndfile], [sndfile.h], [sndfile], [sf_open_virtual])
+SOX_FMT_PKG([libsndfile], [sndfile])
SOX_FMT_REQ([sndfile], [LIBSNDFILE])
SOX_FMT_LIB([wavpack], [wavpack/wavpack.h], [wavpack], [WavpackGetSampleRate])
--
2.45.2

View File

@@ -0,0 +1,36 @@
From ad8ecfbdd9ff184b60600a115247a6aa947d0215 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 22:10:00 +0200
Subject: [PATCH] voc: word width should never be 0 to avoid division by zero
Bug: https://sourceforge.net/p/sox/bugs/351/
Bug-Debian: https://bugs.debian.org/1010374
This patch fixes both CVE-2021-3643 and CVE-2021-23210.
CVE: CVE-2021-3643
CVE: CVE-2021-23210
Upstream: https://sourceforge.net/p/sox/bugs/351/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/voc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/voc.c b/src/voc.c
index a75639e9..0ca07f94 100644
--- a/src/voc.c
+++ b/src/voc.c
@@ -625,6 +625,10 @@ static int getblock(sox_format_t * ft)
v->rate = new_rate_32;
ft->signal.rate = new_rate_32;
lsx_readb(ft, &uc);
+ if (uc <= 1) {
+ lsx_fail_errno(ft, SOX_EFMT, "2 bits per word required");
+ return (SOX_EOF);
+ }
v->size = uc;
lsx_readb(ft, &uc);
if (v->channels != -1 && uc != v->channels) {
--
2.49.0

View File

@@ -0,0 +1,42 @@
From 54455f59305d9ce94cc73100bc2dd542865fed4b Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 22:33:16 +0200
Subject: [PATCH] hcom: validate dictsize
Bug: https://sourceforge.net/p/sox/bugs/350/
Bug: https://sourceforge.net/p/sox/bugs/352/
Bug-Debian: https://bugs.debian.org/1021133
Bug-Debian: https://bugs.debian.org/1021134
This patch fixes both CVE-2021-23159 and CVE-2021-23172.
CVE: CVE-2021-23159
CVE: CVE-2021-23172
CVE: CVE-2023-34318
CVE: CVE-2023-34432
Upstream: https://sourceforge.net/p/sox/bugs/350/
Upstream: https://sourceforge.net/p/sox/bugs/352/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/hcom.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/hcom.c b/src/hcom.c
index 594c8706..9e8b03c6 100644
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -141,6 +141,11 @@ static int startread(sox_format_t * ft)
return (SOX_EOF);
}
lsx_readw(ft, &dictsize);
+ if (dictsize == 0 || dictsize > 511)
+ {
+ lsx_fail_errno(ft, SOX_EHDR, "Implausible dictionary size in HCOM header");
+ return SOX_EOF;
+ }
/* Translate to sox parameters */
ft->encoding.encoding = SOX_ENCODING_HCOM;
--
2.49.0

View File

@@ -0,0 +1,43 @@
From c49c81a3c4409e7c1979ec8cb341fb0c57220616 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 22:48:05 +0200
Subject: [PATCH] phere: avoid integer underflow
Link: https://talosintelligence.com/vulnerability_reports/TALOS-2021-1434
Bug: https://sourceforge.net/p/sox/bugs/362/
Bug-Debian: https://bugs.debian.org/1012138
CVE: CVE-2021-40426
Upstream: https://sourceforge.net/p/sox/bugs/362/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/sphere.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sphere.c b/src/sphere.c
index a3fd1c64..9544d160 100644
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -63,7 +63,8 @@ static int start_read(sox_format_t * ft)
return (SOX_EOF);
}
- header_size -= (strlen(buf) + 1);
+ bytes_read = strlen(buf);
+ header_size -= bytes_read >= header_size ? header_size : bytes_read + 1;
while (strncmp(buf, "end_head", (size_t)8) != 0) {
if (strncmp(buf, "sample_n_bytes", (size_t)14) == 0)
@@ -105,7 +106,8 @@ static int start_read(sox_format_t * ft)
return (SOX_EOF);
}
- header_size -= (strlen(buf) + 1);
+ bytes_read = strlen(buf);
+ header_size -= bytes_read >= header_size ? header_size : bytes_read + 1;
}
if (!bytes_per_sample)
--
2.49.0

View File

@@ -0,0 +1,65 @@
From 452bfd55096e24ff5eb4a5eb491c70125ce05be8 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 22:55:32 +0200
Subject: [PATCH] formats+aiff: reject implausibly large number of channels
Bug: https://sourceforge.net/p/sox/bugs/360/
Bug-Debian: https://bugs.debian.org/1012516
CVE: CVE-2022-31650
CVE: CVE-2023-26590
Upstream: https://sourceforge.net/p/sox/bugs/360/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/aiff.c | 5 +++++
src/formats_i.c | 10 ++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/aiff.c b/src/aiff.c
index 3a152c58..6de94f32 100644
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -619,6 +619,11 @@ int lsx_aiffstartwrite(sox_format_t * ft)
At 48 kHz, 16 bits stereo, this gives ~3 hours of audio.
Sorry, the AIFF format does not provide for an indefinite
number of samples. */
+ if (ft->signal.channels >= (0x7f000000 / (ft->encoding.bits_per_sample >> 3)))
+ {
+ lsx_fail_errno(ft, SOX_EOF, "too many channels for AIFF header");
+ return SOX_EOF;
+ }
return(aiffwriteheader(ft, (uint64_t) 0x7f000000 / ((ft->encoding.bits_per_sample>>3)*ft->signal.channels)));
}
diff --git a/src/formats_i.c b/src/formats_i.c
index 7048040d..6a7c27e3 100644
--- a/src/formats_i.c
+++ b/src/formats_i.c
@@ -19,6 +19,7 @@
*/
#include "sox_i.h"
+#include <limits.h>
#include <string.h>
#include <sys/stat.h>
#include <stdarg.h>
@@ -60,9 +61,14 @@ int lsx_check_read_params(sox_format_t * ft, unsigned channels,
if (ft->seekable)
ft->data_start = lsx_tell(ft);
- if (channels && ft->signal.channels && ft->signal.channels != channels)
+ if (channels && ft->signal.channels && ft->signal.channels != channels) {
lsx_warn("`%s': overriding number of channels", ft->filename);
- else ft->signal.channels = channels;
+ } else if (channels > SHRT_MAX) {
+ lsx_fail_errno(ft, EINVAL, "implausibly large number of channels");
+ return SOX_EOF;
+ } else {
+ ft->signal.channels = channels;
+ }
if (rate && ft->signal.rate && ft->signal.rate != rate)
lsx_warn("`%s': overriding sample rate", ft->filename);
--
2.49.0

View File

@@ -0,0 +1,40 @@
From 6af0a8b32df4d7a83fd52a963a20e6e321f10fd6 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 23:05:33 +0200
Subject: [PATCH] formats: reject implausible rate
Bug: https://sourceforge.net/p/sox/bugs/360/
Bug-Debian: https://bugs.debian.org/1012516
CVE: CVE-2022-31651
Upstream: https://sourceforge.net/p/sox/bugs/360/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/formats_i.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/formats_i.c b/src/formats_i.c
index 6a7c27e3..5f5ef979 100644
--- a/src/formats_i.c
+++ b/src/formats_i.c
@@ -70,9 +70,15 @@ int lsx_check_read_params(sox_format_t * ft, unsigned channels,
ft->signal.channels = channels;
}
- if (rate && ft->signal.rate && ft->signal.rate != rate)
+ if (rate && ft->signal.rate && ft->signal.rate != rate) {
lsx_warn("`%s': overriding sample rate", ft->filename);
- else ft->signal.rate = rate;
+ /* Since NaN comparisons yield false, the negation rejects them. */
+ } else if (!(rate > 0)) {
+ lsx_fail_errno(ft, EINVAL, "invalid rate value");
+ return SOX_EOF;
+ } else {
+ ft->signal.rate = rate;
+ }
if (encoding && ft->encoding.encoding && ft->encoding.encoding != encoding)
lsx_warn("`%s': overriding encoding type", ft->filename);
--
2.49.0

View File

@@ -0,0 +1,38 @@
From 2ab4f13af84f224cfbdd997e027c7348156de463 Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Sat, 17 May 2025 23:07:34 +0200
Subject: [PATCH] CVE-2023-32627 Filter null sampling rate in VOC coder
Avoid a divide by zero and out of bound read by rejecting null sampling rate in VOC file
bug: https://sourceforge.net/p/sox/bugs/369/
bug-redhat: https://bugzilla.redhat.com/show_bug.cgi?id=2212282
bug-debian: https://bugs.debian.org/1041112
bug-debian-security: https://security-tracker.debian.org/tracker/CVE-2023-32627
CVE: CVE-2023-32627
Upstream: https://sourceforge.net/p/sox/bugs/369/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/voc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/voc.c b/src/voc.c
index 0ca07f94..d8b982c5 100644
--- a/src/voc.c
+++ b/src/voc.c
@@ -353,6 +353,11 @@ static size_t read_samples(sox_format_t * ft, sox_sample_t * buf,
v->block_remaining = 0;
return done;
}
+ if(uc == 0) {
+ lsx_fail_errno(ft, EINVAL, "invalid rate value");
+ v->block_remaining = 0;
+ return done;
+ }
*buf = SOX_UNSIGNED_8BIT_TO_SAMPLE(uc,);
lsx_adpcm_init(&v->adpcm, 6 - v->size, SOX_SAMPLE_TO_SIGNED_16BIT(*buf, ft->clips));
++buf;
--
2.49.0

12
package/sox/Config.in Normal file
View File

@@ -0,0 +1,12 @@
config BR2_PACKAGE_SOX
bool "sox"
help
SoX is a cross-platform (Windows, Linux, MacOS X, etc.)
command line utility that can convert various formats of
computer audio files into other formats.
It can also apply various effects to these sound files, and,
as an added bonus, SoX can play and record audio files on
most platforms.
http://sox.sourceforge.net/

4
package/sox/sox.hash Normal file
View File

@@ -0,0 +1,4 @@
# Locally computed
sha256 acea032ef8543e4934bb1f4c821519456ad4bdad8d05b785043adbf07feba284 sox-7524160b29a476f7e87bc14fddf12d349f9a3c5e-git4.tar.gz
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 LICENSE.GPL
sha256 5df07007198989c622f5d41de8d703e7bef3d0e79d62e24332ee739a452af62a LICENSE.LGPL

216
package/sox/sox.mk Normal file
View File

@@ -0,0 +1,216 @@
################################################################################
#
# sox
#
################################################################################
SOX_VERSION = 7524160b29a476f7e87bc14fddf12d349f9a3c5e
SOX_SITE = https://git.code.sf.net/p/sox/code
SOX_SITE_METHOD = git
SOX_DEPENDENCIES = host-autoconf-archive host-pkgconf
SOX_LICENSE = GPL-2.0+ (sox binary), LGPL-2.1+ (libraries)
SOX_LICENSE_FILES = LICENSE.GPL LICENSE.LGPL
SOX_CPE_ID_VENDOR = sound_exchange_project
SOX_CPE_ID_PRODUCT = sound_exchange
# The Git commit in SOX_VERSION is 14.4.2 + a large number of commits
SOX_CPE_ID_VERSION = 14.4.2
# From git and we're patching configure.ac
SOX_AUTORECONF = YES
SOX_AUTORECONF_OPTS = --include=$(HOST_DIR)/share/autoconf-archive
SOX_INSTALL_STAGING = YES
# sox-14.4.2-6-g6e177c45
SOX_IGNORE_CVES += CVE-2017-11332
# sox-14.4.2-7-ge410d00c
SOX_IGNORE_CVES += CVE-2017-11358
# sox-14.4.2-8-g7b3f30e1
SOX_IGNORE_CVES += CVE-2017-11359
# sox-14.4.2-9-ge076a7ad
SOX_IGNORE_CVES += CVE-2017-15370
# sox-14.4.2-10-g968c689a
SOX_IGNORE_CVES += CVE-2017-15371
# sox-14.4.2-11-g515b9861
SOX_IGNORE_CVES += CVE-2017-15372
# sox-14.4.2-12-gf56c0dbc
SOX_IGNORE_CVES += CVE-2017-15642
# sox-14.4.2-13-g09d7388c
# CVE-2019-1010004 is a duplicate of CVE-2017-18189
SOX_IGNORE_CVES += CVE-2017-18189 CVE-2019-1010004
# sox-14.4.2-38-gf7091126
SOX_IGNORE_CVES += CVE-2019-8354
# sox-14.4.2-39-gf8587e2d
SOX_IGNORE_CVES += CVE-2019-8355
# sox-14.4.2-40-gb7883ae1
SOX_IGNORE_CVES += CVE-2019-8356
# sox-14.4.2-41-g2ce02fea
SOX_IGNORE_CVES += CVE-2019-8357
# sox-14.4.2-44-g7b6a8892
SOX_IGNORE_CVES += CVE-2019-13590
# 0006-voc-word-width-should-never-be-0-to-avoid-division-b.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to sox_project:sox in the NVD database
SOX_IGNORE_CVES += CVE-2021-3643 CVE-2021-23210
# 0007-hcom-validate-dictsize.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to sox_project:sox in the NVD database
SOX_IGNORE_CVES += CVE-2021-23159 CVE-2021-23172 CVE-2023-34318 CVE-2023-34432
# 0008-phere-avoid-integer-underflow.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to libsox_project:libsox in the NVD database
SOX_IGNORE_CVES += CVE-2021-40426
# 0009-formats-aiff-reject-implausibly-large-number-of-chan.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to sox_project:sox in the NVD database
SOX_IGNORE_CVES += CVE-2022-31650 CVE-2023-26590
# 0010-formats-reject-implausible-rate.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to sox_project:sox in the NVD database
SOX_IGNORE_CVES += CVE-2022-31651
# 0011-CVE-2023-32627-Filter-null-sampling-rate-in-VOC-code.patch
# This entry is NOT stale, those CVEs are not reported by pkg-stats
# due to the change of CPE ID to sox_project:sox in the NVD database
SOX_IGNORE_CVES += CVE-2023-32627
SOX_CONF_OPTS = \
--with-distro="Buildroot" \
--disable-stack-protector
SOX_CFLAGS = $(TARGET_CFLAGS)
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
SOX_CFLAGS += -O0
endif
SOX_CONF_ENV += CFLAGS="$(SOX_CFLAGS)"
ifeq ($(BR2_PACKAGE_ALSA_LIB_PCM),y)
SOX_DEPENDENCIES += alsa-lib
SOX_CONF_OPTS += --enable-alsa
else
SOX_CONF_OPTS += --disable-alsa
endif
ifeq ($(BR2_PACKAGE_FILE),y)
SOX_DEPENDENCIES += file
SOX_CONF_OPTS += --enable-magic
else
SOX_CONF_OPTS += --disable-magic
endif
ifeq ($(BR2_PACKAGE_FLAC),y)
SOX_DEPENDENCIES += flac
SOX_CONF_OPTS += --enable-flac
else
SOX_CONF_OPTS += --disable-flac
endif
ifeq ($(BR2_PACKAGE_LAME),y)
SOX_DEPENDENCIES += lame
SOX_CONF_OPTS += --with-lame
else
SOX_CONF_OPTS += --without-lame
endif
ifeq ($(BR2_PACKAGE_LIBAO),y)
SOX_DEPENDENCIES += libao
SOX_CONF_OPTS += --enable-ao
else
SOX_CONF_OPTS += --disable-ao
endif
ifeq ($(BR2_PACKAGE_LIBGSM),y)
SOX_DEPENDENCIES += libgsm
SOX_CONF_OPTS += --enable-gsm
else
SOX_CONF_OPTS += --disable-gsm
endif
ifeq ($(BR2_PACKAGE_LIBID3TAG),y)
SOX_DEPENDENCIES += libid3tag
SOX_CONF_OPTS += --with-id3tag
else
SOX_CONF_OPTS += --without-id3tag
endif
ifeq ($(BR2_PACKAGE_LIBMAD),y)
SOX_DEPENDENCIES += libmad
SOX_CONF_OPTS += --with-mad
else
SOX_CONF_OPTS += --without-mad
endif
ifeq ($(BR2_PACKAGE_LIBPNG),y)
SOX_DEPENDENCIES += libpng
SOX_CONF_OPTS += --with-png
else
SOX_CONF_OPTS += --without-png
endif
ifeq ($(BR2_PACKAGE_LIBSNDFILE),y)
SOX_DEPENDENCIES += libsndfile
SOX_CONF_OPTS += --enable-sndfile
else
SOX_CONF_OPTS += --disable-sndfile
endif
ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
SOX_DEPENDENCIES += libvorbis
SOX_CONF_OPTS += --enable-oggvorbis
else
SOX_CONF_OPTS += --disable-oggvorbis
endif
ifeq ($(BR2_PACKAGE_OPENCORE_AMR),y)
SOX_DEPENDENCIES += opencore-amr
SOX_CONF_OPTS += --enable-amrwb --enable-amrnb
else
SOX_CONF_OPTS += --disable-amrwb --disable-amrnb
endif
ifeq ($(BR2_PACKAGE_OPUSFILE),y)
SOX_DEPENDENCIES += opusfile
SOX_CONF_OPTS += --enable-opus
else
SOX_CONF_OPTS += --disable-opus
endif
ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
SOX_DEPENDENCIES += pulseaudio
SOX_CONF_OPTS += --enable-pulseaudio
else
SOX_CONF_OPTS += --disable-pulseaudio
endif
ifeq ($(BR2_PACKAGE_TWOLAME),y)
SOX_DEPENDENCIES += twolame
SOX_CONF_OPTS += --with-twolame
else
SOX_CONF_OPTS += --without-twolame
endif
ifeq ($(BR2_PACKAGE_WAVPACK),y)
SOX_DEPENDENCIES += wavpack
SOX_CONF_OPTS += --enable-wavpack
else
SOX_CONF_OPTS += --disable-wavpack
endif
$(eval $(autotools-package))