shithub: sox

Download patch

ref: c7a10cd0324841dcf45200ed2ae8f2aa9fb63886
parent: 86791c4beb0235121173d9ced1b166d03eeda31b
parent: fb412eb21ecea7d73380ef854b743e8c35d33422
author: Ulrich Klauer <ulrich@chirlu.de>
date: Sat Feb 2 06:38:18 EST 2013

Merge branch 'dot' into master

--- a/ChangeLog
+++ b/ChangeLog
@@ -49,7 +49,7 @@
   o Fix memory leaks. (Ulrich Klauer)
 
 
-sox-14.4.1	20xx-xx-xx
+sox-14.4.1	2013-02-01
 ----------
 
 Newly deprecated features (to be removed in future):
@@ -85,6 +85,7 @@
   o Fix memory leaks in LADSPA effect. (Eric Wong)
   o Fix hang in several effects (rate, tempo, and those based on
     dft_filter) when processing long files. [3592482, 3594822] (MrMod)
+  o Prevent (m)compand from tampering with their arguments. (Ulrich Klauer)
 
 Other bug fixes:
 
@@ -91,6 +92,8 @@
   o Fix input length calculation for combine methods other than
     concatenate. (Ulrich Klauer)
   o Fix to configure.ac to work with Autoconf 2.69. [3600293] (cbagwell)
+  o Use binary mode for pipes on all Windows compilers, rather than
+    MSVC only. [3602130] (Ulrich Klauer)
 
 
 sox-14.4.0	2012-03-04
--- a/NEWS
+++ b/NEWS
@@ -1,21 +1,14 @@
-Highlights for this release include:
+Highlights for this maintenance release include:
 
- o Add floating point encodings in AIFF-C files.
- o Pad WAV data chunks to an even number of bytes.
- o Made Pulse Audio driver the default driver.
- o Fix crash when specifying OSX coreaudio device name.
- o Lots of improvements to man pages.
- o New upsample, hilbert, and downsample effects.
- o Fix fading bugs.
- o Enable --plot on biquad and fir effects.
- o Now effects chain can be unlimitted length.
- o Fix newfile/restart effects when merging or mixing files.
- o Fix crash in compand and mcompand effect.
- o Improved audio length calculations when using effects.
- o New trim effect with enhanced capabilities.
- o Fix -p option on Windows.
- o Improved large file support.
- o MP2 write support.
+ o Check that PulseAudio is present before trying to use it.
+ o Use binary mode for pipe inputs ("|sox ...") on Windows.
+ o Re-enable file-type detection when reading from a pipe.
+ o Fix crash when seeking within a FLAC file.
+ o Fix hang in rate and other effects when processing long files.
+ o Audio length calculation fixes.
+ o Many other bug fixes.
 
-For the complete list of changes, see the ChangeLog at
-  http://sox.git.sourceforge.net/git/gitweb.cgi?p=sox/sox;a=blob;f=ChangeLog
+For an extensive list of changes, see the ChangeLog at
+  http://sox.git.sourceforge.net/git/gitweb.cgi?p=sox/sox;hb=sox-14.4.1;f=ChangeLog
+or consult the complete development history at
+  http://sox.git.sourceforge.net/git/gitweb.cgi?p=sox/sox;a=history;hpb=sox-14.4.0;hb=sox-14.4.1
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,12 @@
 sox (14.4.2git-0+git20130122-1) UNRELEASED; urgency=low
 
+  * [debian/control]:
+    - Bumped libsox2 to libsox3, interface changes.
+
+ -- Pascal Giard <evilynux@gmail.com>  Tue, 22 Jan 2013 22:56:30 -0500
+
+sox (14.4.1rc2-0+git20130122-1) UNRELEASED; urgency=low
+
   * Git Version (closes: #676143).
   * [debian/source/format]:
     - Finally switched to dpkg-source 3.0 (quilt) format!
@@ -8,7 +15,6 @@
       "debian-rules-uses-deprecated-makefile". 
     - Added multiarch support.
   * [debian/control]:
-    - Bumped libsox2 to libsox3, interface changes.
     - Added Vcs-Git and Vcs-Browser pointing to upstream VCS.
     - Added Pre-Depends on multiarch-support for libsox3, does not seem to
       required for the other packages (contradiction in the documentation?),
--- a/debian/sox.dirs
+++ /dev/null
@@ -1,2 +1,0 @@
-usr/bin
-usr/share
--- /dev/null
+++ b/debian/sox.dirs.in
@@ -1,0 +1,2 @@
+usr/bin
+usr/share
--- a/sox.1
+++ b/sox.1
@@ -29,7 +29,7 @@
 .SP
 .fi
 ..
-.TH SoX 1 "February 19, 2011" "sox" "Sound eXchange"
+.TH SoX 1 "February 1, 2013" "sox" "Sound eXchange"
 .SH NAME
 SoX \- Sound eXchange, the Swiss Army knife of audio manipulation
 .SH SYNOPSIS
@@ -1392,7 +1392,7 @@
 instrument or `voice'.  To facilitate this, the \fBremix\fR effect and
 the global SoX option \fB\-M\fR can be used to isolate then recombine
 tracks from a multi-track recording.
-.SS Multiple Effect Chains
+.SS Multiple Effects Chains
 A single effects chain is made up of one or more effects.  Audio from
 the input runs through the chain until either the end of the input file
 is reached or an effect in the chain requests to terminate the chain.
@@ -4289,7 +4289,7 @@
 .IR "LADSPA plugins" ,
 http://plugin.org.uk
 .SH LICENSE
-Copyright 1998\-2011 Chris Bagwell and SoX Contributors.
+Copyright 1998\-2013 Chris Bagwell and SoX Contributors.
 .br
 Copyright 1991 Lance Norskog and Sundry Contributors.
 .SP
--- a/soxformat.7
+++ b/soxformat.7
@@ -29,7 +29,7 @@
 .SP
 .fi
 ..
-.TH SoX 7 "February 19, 2011" "soxformat" "Sound eXchange"
+.TH SoX 7 "February 1, 2013" "soxformat" "Sound eXchange"
 .SH NAME
 SoX \- Sound eXchange, the Swiss Army knife of audio manipulation
 .SH DESCRIPTION
@@ -722,7 +722,7 @@
 supported with SoX) e.g. MP3; in some cases such a file can still be
 read by SoX by overriding the file type, e.g.
 .EX
-   play -t mp3 mp3-encoded.wav
+   play \-t mp3 mp3\-encoded.wav
 .EE
 Big endian versions of RIFF files, called RIFX, are also supported.
 To write a RIFX file, use the
@@ -818,7 +818,7 @@
 .IR "PLS" ,
 http://en.wikipedia.org/wiki/PLS_(file_format)
 .SH LICENSE
-Copyright 1998\-2011 Chris Bagwell and SoX Contributors.
+Copyright 1998\-2013 Chris Bagwell and SoX Contributors.
 .br
 Copyright 1991 Lance Norskog and Sundry Contributors.
 .SH AUTHORS
--- a/soxi.1
+++ b/soxi.1
@@ -29,7 +29,7 @@
 .SP
 .fi
 ..
-.TH SoXI 1 "February 19, 2011" "soxi" "Sound eXchange"
+.TH SoXI 1 "February 1, 2013" "soxi" "Sound eXchange"
 .SH NAME
 SoXI \- Sound eXchange Information, display sound file metadata
 .SH SYNOPSIS
@@ -103,7 +103,7 @@
 .SP
 The SoX web site at http://sox.sourceforge.net
 .SH LICENSE
-Copyright 2008-9 by Chris Bagwell and SoX Contributors.
+Copyright 2008\-2013 by Chris Bagwell and SoX Contributors.
 .SP
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
--- a/src/compand.c
+++ b/src/compand.c
@@ -58,6 +58,10 @@
   ptrdiff_t delay_buf_index; /* Index into delay_buf */
   ptrdiff_t delay_buf_cnt; /* No. of active entries in delay_buf */
   int delay_buf_full;       /* Shows buffer situation (important for drain) */
+
+  char *arg0;  /* copies of arguments, so that they may be modified */
+  char *arg1;
+  char *arg2;
 } priv_t;
 
 static int getopts(sox_effect_t * effp, int argc, char * * argv)
@@ -71,8 +75,12 @@
   if (argc < 2 || argc > 5)
     return lsx_usage(effp);
 
+  l->arg0 = lsx_strdup(argv[0]);
+  l->arg1 = lsx_strdup(argv[1]);
+  l->arg2 = argc > 2 ? lsx_strdup(argv[2]) : NULL;
+
   /* Start by checking the attack and decay rates */
-  for (s = argv[0], commas = 0; *s; ++s) if (*s == ',') ++commas;
+  for (s = l->arg0, commas = 0; *s; ++s) if (*s == ',') ++commas;
   if ((commas % 2) == 0) {
     lsx_fail("there must be an even number of attack/decay parameters");
     return SOX_EOF;
@@ -83,7 +91,7 @@
 
   /* Now tokenise the rates string and set up these arrays.  Keep
      them in seconds at the moment: we don't know the sample rate yet. */
-  for (i = 0, s = strtok(argv[0], ","); s != NULL; ++i) {
+  for (i = 0, s = strtok(l->arg0, ","); s != NULL; ++i) {
     for (j = 0; j < 2; ++j) {
       if (sscanf(s, "%lf %c", &l->channels[i].attack_times[j], &dummy) != 1) {
         lsx_fail("syntax error trying to read attack/decay time");
@@ -96,7 +104,7 @@
     }
   }
 
-  if (!lsx_compandt_parse(&l->transfer_fn, argv[1], argc>2 ? argv[2] : 0))
+  if (!lsx_compandt_parse(&l->transfer_fn, l->arg1, l->arg2))
     return SOX_EOF;
 
   /* Set the initial "volume" to be attibuted to the input channels.
@@ -269,6 +277,9 @@
 
   lsx_compandt_kill(&l->transfer_fn);
   free(l->channels);
+  free(l->arg0);
+  free(l->arg1);
+  free(l->arg2);
   return SOX_SUCCESS;
 }
 
--- a/src/mcompand.c
+++ b/src/mcompand.c
@@ -72,6 +72,8 @@
   size_t band_buf_len;
   size_t delay_buf_size;/* Size of delay_buf in samples */
   comp_band_t *bands;
+
+  char *arg; /* copy of current argument */
 } priv_t;
 
 /*
@@ -174,7 +176,7 @@
   /* how many bands? */
   if (! (argc&1)) {
     lsx_fail("mcompand accepts only an odd number of arguments:\argc"
-            "  mcompand quoted_compand_args [crossover_freq quoted_compand_args [...]");
+            "  mcompand quoted_compand_args [crossover_freq quoted_compand_args [...]]");
     return SOX_EOF;
   }
   c->nBands = (argc+1)>>1;
@@ -182,10 +184,13 @@
   c->bands = lsx_calloc(c->nBands, sizeof(comp_band_t));
 
   for (i=0;i<c->nBands;++i) {
-    if (parse_subarg(argv[i<<1],subargv,&subargc) != SOX_SUCCESS)
+    c->arg = lsx_strdup(argv[i<<1]);
+    if (parse_subarg(c->arg,subargv,&subargc) != SOX_SUCCESS)
       return SOX_EOF;
     if (sox_mcompand_getopts_1(&c->bands[i], subargc, &subargv[0]) != SOX_SUCCESS)
       return SOX_EOF;
+    free(c->arg);
+    c->arg = NULL;
     if (i == (c->nBands-1))
       c->bands[i].topfreq = 0;
     else {
@@ -493,6 +498,7 @@
     free(l->attackRate);
     free(l->volume);
   }
+  free(c->arg);
   free(c->bands);
   c->bands = NULL;
 
--- a/src/util.h
+++ b/src/util.h
@@ -121,7 +121,6 @@
 #define open _open
 #define pclose _pclose
 #define popen _popen
-#define POPEN_MODE "rb"
 #define setmode _setmode
 #define snprintf _snprintf
 
@@ -161,6 +160,7 @@
   #define LAST_SLASH(path) max(strrchr(path, '/'), strrchr(path, '\\'))
   #define IS_ABSOLUTE(path) ((path)[0] == '/' || (path)[0] == '\\' || (path)[1] == ':')
   #define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+  #define POPEN_MODE "rb"
 #else
   #define LAST_SLASH(path) strrchr(path, '/')
   #define IS_ABSOLUTE(path) ((path)[0] == '/')