shithub: sox

Download patch

ref: bae8fdc12314d5ba0dfaeaf17437ab7c678d100f
parent: 2c31c161e39b25569893e35ff0952ecabcede8b6
author: robs <robs>
date: Fri Dec 12 05:36:21 EST 2008

fix [2404566] segfault when converting from MS ADPCM wav file

--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
   o Fix AIFF file length bug to stop reading trash data on files that
     have extra chunks at end of file. (Joe Holt)
   o Fix file length being 4 bytes short for AIFF sowt CD tracks. (Joe Holt)
+  o Fix [2404566] segfault when converting from MS ADPCM wav file.  (robs)
 
 Effects:
 
--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -152,11 +152,11 @@
                 while (op < top) {
                         b = *ip++;
                         tmp = op;
-                        *op++ = AdpcmDecode(b >> 4, state+ch, tmp[-chans], tmp[-(2*chans)]);
+                        *op++ = AdpcmDecode(b >> 4, state+ch, tmp[-(int)chans], tmp[-(int)(2*chans)]);
                         if (++ch == chans) ch = 0;
                         /* ch = ++ch % chans; */
                         tmp = op;
-                        *op++ = AdpcmDecode(b&0x0f, state+ch, tmp[-chans], tmp[-(2*chans)]);
+                        *op++ = AdpcmDecode(b&0x0f, state+ch, tmp[-(int)chans], tmp[-(int)(2*chans)]);
                         if (++ch == chans) ch = 0;
                         /* ch = ++ch % chans; */
                 }