[MPlayer-cvslog] r27246 - trunk/libmpdemux/demux_audio.c

reimar subversion at mplayerhq.hu
Thu Jul 10 21:29:03 CEST 2008


Author: reimar
Date: Thu Jul 10 21:29:02 2008
New Revision: 27246

Log:
Clean up reading of wav extradata.
Fixes bug #1135


Modified:
   trunk/libmpdemux/demux_audio.c

Modified: trunk/libmpdemux/demux_audio.c
==============================================================================
--- trunk/libmpdemux/demux_audio.c	(original)
+++ trunk/libmpdemux/demux_audio.c	Thu Jul 10 21:29:02 2008
@@ -391,19 +391,15 @@ static int demux_audio_open(demuxer_t* d
     sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
     l -= 16;
     if (l > 0) {
-    w->cbSize = stream_read_word_le(s);
+    w->cbSize = FFMAX(stream_read_word_le(s), 0);
     l -= 2;
-     if (w->cbSize > 0) {
       if (l < w->cbSize) {
         mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] truncated extradata (%d < %d)\n",
 	l,w->cbSize);
-        stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),l);
-        l = 0;
-      } else {
+        l = w->cbSize;
+      }
         stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize);
         l -= w->cbSize;
-      }
-     }
     }
 
     if( mp_msg_test(MSGT_DEMUX,MSGL_V) ) print_wave_header(w, MSGL_V);



More information about the MPlayer-cvslog mailing list