aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-07-10 19:29:02 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-07-10 19:29:02 +0000
commitbbb598b9eb16ad1b9608b3d21670d1f6d2a640a8 (patch)
tree5e02c670a999e6ee6a04c131e770599264681bcf
parent4a6cd3026e02d28ac22d3ff838f31e2d42af8bf9 (diff)
Clean up reading of wav extradata.
Fixes bug #1135 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27246 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/demux_audio.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c
index 269fa23539..fbbbdae088 100644
--- a/libmpdemux/demux_audio.c
+++ b/libmpdemux/demux_audio.c
@@ -391,19 +391,15 @@ 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);