[FFmpeg-cvslog] avidec: avoid infinite loop due to negative ast->sample_size

Andreas Cadhalpun git at videolan.org
Mon Jun 1 13:11:22 CEST 2015


ffmpeg | branch: release/2.2 | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Mon May  4 23:01:45 2015 +0200| [0658aef53a86a9f5bb9257faa1f641e765c6d007] | committer: Michael Niedermayer

avidec: avoid infinite loop due to negative ast->sample_size

If max in clean_index is set to a negative ast->sample_size, the
following loop never ends:
        while (max < 1024)
            max += max;

Thus set ast->sample_size to 0 if it would otherwise be negative.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit ca234639ac49a0dc073ac1f10977979acdb94f97)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0658aef53a86a9f5bb9257faa1f641e765c6d007
---

 libavformat/avidec.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 7512622..cfcd85b 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -604,6 +604,7 @@ static int avi_read_header(AVFormatContext *s)
             default:
                 av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1);
             }
+            ast->sample_size = FFMAX(ast->sample_size, 0);
             if (ast->sample_size == 0) {
                 st->duration = st->nb_frames;
                 if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) {



More information about the ffmpeg-cvslog mailing list