Przeglądaj źródła

sox: update to latest git, with patches from buildroot

Waldemar Brodkorb 3 miesięcy temu
rodzic
commit
abdfa91bd9

+ 4 - 2
package/sox/Makefile

@@ -4,7 +4,8 @@
 include $(ADK_TOPDIR)/rules.mk
 
 PKG_NAME:=		sox
-PKG_VERSION:=		14.4.2
+PKG_VERSION:=		f3094754a7c2a7e55c35621d20fa9945736e72df
+PKG_GIT:=		hash
 PKG_RELEASE:=		1
 PKG_HASH:=		b45f598643ffbd8e363ff24d61166ccec4836fea6d3888881b8df53e3bb55f6c
 PKG_DESCR:=		swiss army knife of sound processing programs
@@ -13,7 +14,7 @@ PKG_DEPENDS:=		zlib libncurses
 PKG_BUILDDEP:=		zlib ncurses
 PKG_NEEDS:=		threads
 PKG_URL:=		http://sox.sourceforge.net/
-PKG_SITES:=		${MASTER_SITE_SOURCEFORGE:=sox/}
+PKG_SITES:=		https://git.code.sf.net/p/sox/code.git
 
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.gz
 
@@ -41,6 +42,7 @@ include $(ADK_TOPDIR)/mk/package.mk
 
 $(eval $(call PKG_template,SOX,sox,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
 
+AUTOTOOL_STYLE:=	autoreconf
 CONFIGURE_ARGS+=	--disable-openmp \
 			--without-magic \
 			--without-ladspa \

+ 35 - 0
package/sox/patches/patch-configure_ac

@@ -0,0 +1,35 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/configure.ac	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/configure.ac	2026-05-15 15:53:00.571091052 +0200
+@@ -32,10 +32,6 @@ AC_PROG_LN_S
+ PKG_PROG_PKG_CONFIG
+ PKG_INSTALLDIR
+ 
+-AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong])
+-AX_APPEND_COMPILE_FLAGS([-Wall -Wmissing-prototypes -Wstrict-prototypes])
+-AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
+-
+ dnl Check for system dependent features.
+ AC_C_BIGENDIAN
+ AC_C_INLINE
+@@ -80,10 +76,10 @@ SOX_REPORT([other], [LADSPA effect plugi
+ 
+ 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])
++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
+@@ -117,7 +113,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])

+ 14 - 0
package/sox/patches/patch-src_aiff_c

@@ -0,0 +1,14 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/aiff.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/aiff.c	2026-05-15 13:57:27.438679050 +0200
+@@ -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)));
+ }
+ 

+ 6 - 6
package/sox/patches/patch-src_formats_c

@@ -1,15 +1,15 @@
---- sox-14.4.1.orig/src/formats.c	2013-01-13 20:57:39.000000000 +0100
-+++ sox-14.4.1/src/formats.c	2014-03-29 15:00:39.000000000 +0100
-@@ -409,7 +409,7 @@ static void UNUSED rewind_pipe(FILE * fp
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/formats.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/formats.c	2026-05-15 15:54:36.616074058 +0200
+@@ -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 || defined _WIN32 || defined _WIN64 || defined _ISO_STDIO_ISO_H
-   fp->_ptr = fp->_base;
-@@ -417,7 +417,7 @@ static void UNUSED rewind_pipe(FILE * fp
+ #elif defined _MSC_VER && _MSC_VER >= 1900
+   #define NO_REWIND_PIPE
+@@ -477,7 +477,7 @@ 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 - */

+ 39 - 0
package/sox/patches/patch-src_formats_i_c

@@ -0,0 +1,39 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/formats_i.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/formats_i.c	2026-05-15 13:57:31.946680393 +0200
+@@ -19,6 +19,7 @@
+  */
+ 
+ #include "sox_i.h"
++#include <limits.h>
+ #include <string.h>
+ #include <sys/stat.h>
+ #include <stdarg.h>
+@@ -60,13 +61,24 @@ int lsx_check_read_params(sox_format_t *
+   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)
++  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);

+ 14 - 0
package/sox/patches/patch-src_hcom_c

@@ -0,0 +1,14 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/hcom.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/hcom.c	2026-05-15 13:57:18.882676216 +0200
+@@ -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;

+ 70 - 0
package/sox/patches/patch-src_soxconfig_h_in

@@ -0,0 +1,70 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/soxconfig.h.in	2026-05-15 15:55:40.360695601 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/soxconfig.h.in	2026-05-15 15:53:15.299245834 +0200
+@@ -9,9 +9,6 @@
+ /* Define to dlopen() lame */
+ #undef DL_LAME
+ 
+-/* Define to dlopen() libsndfile */
+-#undef DL_LIBSNDFILE
+-
+ /* Define to dlopen() mad */
+ #undef DL_MAD
+ 
+@@ -87,7 +84,7 @@
+ /* Define to 1 if you have the <gsm.h> header file. */
+ #undef HAVE_GSM_H
+ 
+-/* Define if id3_file_open exists in -l$sox_wl */
++/* Define if id3_file_open exists in -l$sox_wl $ZLIB_LIBS */
+ #undef HAVE_ID3TAG
+ 
+ /* Define to 1 if you have the <id3tag.h> header file. */
+@@ -129,7 +126,7 @@
+ /* Define if pa_simple_new exists in -lpulse -lpulse-simple */
+ #undef HAVE_LIBPULSEAUDIO
+ 
+-/* Define if sf_open_virtual exists in -l$sox_wl */
++/* Define if libsndfile is enabled */
+ #undef HAVE_LIBSNDFILE
+ 
+ /* Define if sio_open exists in -lsndio */
+@@ -159,12 +156,9 @@
+ /* Define to 1 if you have the <mad.h> header file. */
+ #undef HAVE_MAD_H
+ 
+-/* Define if magic_open exists in -l$sox_wl */
++/* Define if magic is enabled */
+ #undef HAVE_MAGIC
+ 
+-/* Define to 1 if you have the <magic.h> header file. */
+-#undef HAVE_MAGIC_H
+-
+ /* Define to 1 if you have the 'mkstemp' function. */
+ #undef HAVE_MKSTEMP
+ 
+@@ -216,9 +210,6 @@
+ /* Define if sndfile is enabled */
+ #undef HAVE_SNDFILE
+ 
+-/* Define to 1 if you have the <sndfile.h> header file. */
+-#undef HAVE_SNDFILE_H
+-
+ /* Define if sndio is enabled */
+ #undef HAVE_SNDIO
+ 
+@@ -357,9 +348,15 @@
+ /* Define if gsm is linked in */
+ #undef STATIC_GSM
+ 
++/* Define if libsndfile is linked in */
++#undef STATIC_LIBSNDFILE
++
+ /* Define if lpc10 is linked in */
+ #undef STATIC_LPC10
+ 
++/* Define if magic is linked in */
++#undef STATIC_MAGIC
++
+ /* Define if mp3 is linked in */
+ #undef STATIC_MP3
+ 

+ 22 - 0
package/sox/patches/patch-src_sphere_c

@@ -0,0 +1,22 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/sphere.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/sphere.c	2026-05-15 13:57:23.710677858 +0200
+@@ -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)

+ 25 - 0
package/sox/patches/patch-src_voc_c

@@ -0,0 +1,25 @@
+--- sox-f3094754a7c2a7e55c35621d20fa9945736e72df.orig/src/voc.c	2026-05-15 13:54:15.000000000 +0200
++++ sox-f3094754a7c2a7e55c35621d20fa9945736e72df/src/voc.c	2026-05-15 13:57:35.534681392 +0200
+@@ -353,6 +353,11 @@ static size_t read_samples(sox_format_t
+             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;
+@@ -625,6 +630,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) {