[MPlayer-cvslog] r22121 - trunk/libmpdemux/demux_audio.c
reimar
subversion at mplayerhq.hu
Sun Feb 4 10:33:58 CET 2007
Author: reimar
Date: Sun Feb 4 10:33:57 2007
New Revision: 22121
Modified:
trunk/libmpdemux/demux_audio.c
Log:
Do not read beyond end of data chunk if chunk_size is set.
Sample: http://samples.mplayerhq.hu/A-codecs/wavpcm/ahh.wav
Modified: trunk/libmpdemux/demux_audio.c
==============================================================================
--- trunk/libmpdemux/demux_audio.c (original)
+++ trunk/libmpdemux/demux_audio.c Sun Feb 4 10:33:57 2007
@@ -454,7 +454,7 @@
stream_skip(demuxer->stream, chunk_size);
} while (chunk_type != mmioFOURCC('d', 'a', 't', 'a'));
demuxer->movi_start = stream_tell(s);
- demuxer->movi_end = s->end_pos;
+ demuxer->movi_end = chunk_size ? demuxer->movi_start + chunk_size : s->end_pos;
// printf("wav: %X .. %X\n",(int)demuxer->movi_start,(int)demuxer->movi_end);
// Check if it contains dts audio
if((w->wFormatTag == 0x01) && (w->nChannels == 2) && (w->nSamplesPerSec == 44100)) {
@@ -598,6 +598,11 @@
case WAV : {
unsigned align = sh_audio->wf->nBlockAlign;
l = sh_audio->wf->nAvgBytesPerSec;
+ if (demux->movi_end && l > demux->movi_end - stream_tell(s)) {
+ // do not read beyond end, there might be junk after data chunk
+ l = demux->movi_end - stream_tell(s);
+ if (l <= 0) return 0;
+ }
if (align)
l = (l + align - 1) / align * align;
dp = new_demux_packet(l);
More information about the MPlayer-cvslog
mailing list