changeset 700:27a557e80e15 trunk

[svn] - fix a ringbuffering error. found by purify.
author nenolod
date Wed, 21 Feb 2007 02:02:10 -0800
parents 14f80d61e855
children 07fa51808275
files ChangeLog src/aac/src/libmp4.c
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 20 18:12:05 2007 -0800
+++ b/ChangeLog	Wed Feb 21 02:02:10 2007 -0800
@@ -1,3 +1,11 @@
+2007-02-21 02:12:05 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1484]
+  - TCON frame without string crashes mad_parse_genre().
+  
+  trunk/src/madplug/input.c |    3 +++
+  1 file changed, 3 insertions(+)
+
+
 2007-02-20 21:50:17 +0000  Derek Pomery <nemo@m8y.org>
   revision [1482]
   Bug #806
--- a/src/aac/src/libmp4.c	Tue Feb 20 18:12:05 2007 -0800
+++ b/src/aac/src/libmp4.c	Wed Feb 21 02:02:10 2007 -0800
@@ -728,12 +728,14 @@
     mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels);
     playback->output->flush(0);
 
-    while(buffer_playing && buffervalid > 0 && buffer != NULL){
+    while(buffer_playing && buffervalid > 0 && buffer != NULL)
+    {
         faacDecFrameInfo    finfo;
         unsigned long   samplesdecoded;
         char*       sample_buffer = NULL;
 
-        if(bufferconsumed > 0){
+        if(bufferconsumed > 0)
+        {
             memmove(buffer, &buffer[bufferconsumed], buffervalid);
             buffervalid -= bufferconsumed;
             buffervalid += vfs_fread(&buffer[buffervalid], 1,
@@ -774,7 +776,8 @@
         bufferconsumed += finfo.bytesconsumed;
         samplesdecoded = finfo.samples;
 
-        if(finfo.error > 0 && remote != FALSE){
+        if(finfo.error > 0 && remote != FALSE)
+        {
             memmove(buffer, &buffer[1], buffervalid);
             if(buffervalid < BUFFER_SIZE) {
                buffervalid +=
@@ -782,8 +785,8 @@
 	    }
             bufferconsumed = aac_probe(buffer, buffervalid);
             if(bufferconsumed) {
+               buffervalid -= bufferconsumed;
                memmove(buffer, &buffer[bufferconsumed], buffervalid);
-               buffervalid -= bufferconsumed;
                bufferconsumed = 0;
             }
             continue;