Clean up reading of wav extradata.

Fixes bug #1135


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27246 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-07-10 19:29:02 +00:00
parent 4a6cd3026e
commit bbb598b9eb
1 changed files with 3 additions and 7 deletions

View File

@ -391,20 +391,16 @@ static int demux_audio_open(demuxer_t* demuxer) {
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);
if(l)