[Mplayer-cvslog] CVS: main/libmpdemux demux_audio.c,1.17,1.18

Roberto Togni CVS rtognimp at mplayerhq.hu
Sat Mar 15 20:41:12 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv11166

Modified Files:
	demux_audio.c 
Log Message:
Same behaviour as old code for short headers

Index: demux_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_audio.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- demux_audio.c	15 Mar 2003 14:12:22 -0000	1.17
+++ demux_audio.c	15 Mar 2003 19:40:52 -0000	1.18
@@ -158,7 +158,7 @@
     WAVEFORMATEX* w;
     int l;
     l = stream_read_dword_le(s);
-    if(l < sizeof(WAVEFORMATEX)) {
+    if(l < 16) {
       mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] Bad wav header length: too short (%d)!!!\n",l);
       free_sh_audio(sh_audio);
       return 0;
@@ -170,8 +170,10 @@
     w->nAvgBytesPerSec = stream_read_dword_le(s);
     w->nBlockAlign = stream_read_word_le(s);
     w->wBitsPerSample = sh_audio->samplesize = stream_read_word_le(s);
+    l -= 16;
+    if (l > 0) {
     w->cbSize = stream_read_word_le(s);
-    l -= sizeof(WAVEFORMATEX);
+    l -= 2;
     if (w->cbSize > 0)
       if (l < w->cbSize) {
         mp_msg(MSGT_DEMUX,MSGL_ERR,"[demux_audio] truncated extradata (%d < %d)\n",
@@ -182,6 +184,7 @@
         stream_read(s,(char*)((char*)(w)+sizeof(WAVEFORMATEX)),w->cbSize);
         l -= w->cbSize;
       }
+    }
 
     if(verbose>0) print_wave_header(w);
     if(l)



More information about the MPlayer-cvslog mailing list