changeset 22427:08045a99dddb

Do not read more audio samples than available
author reimar
date Sun, 04 Mar 2007 14:11:44 +0000
parents 807484e8d248
children 2c76886e24fc
files libmpdemux/demux_avs.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avs.c	Sun Mar 04 13:56:45 2007 +0000
+++ b/libmpdemux/demux_avs.c	Sun Mar 04 14:11:44 2007 +0000
@@ -208,7 +208,10 @@
     {
         sh_audio_t *sh_audio = ds->sh;
         int samples = sh_audio->samplerate;
-        uint64_t l = samples * sh_audio->channels * sh_audio->samplesize;
+        uint64_t l;
+        samples = FFMIN(samples, AVS->video_info->num_audio_samples - AVS->sampleno);
+        if (!samples) return 0;
+        l = samples * sh_audio->channels * sh_audio->samplesize;
         if (l > INT_MAX) {
             mp_msg(MSGT_DEMUX, MSGL_FATAL, "AVS: audio packet too big\n");
             return 0;