[FFmpeg-cvslog] avi: Validate sample_size

Andreas Cadhalpun git at videolan.org
Tue May 19 21:36:41 CEST 2015


ffmpeg | branch: release/2.4 | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Wed May  6 02:26:57 2015 +0200| [a55a70644872027fdf76a75edf12a09c9008880f] | committer: Vittorio Giovara

avi: Validate sample_size

And either error out or set it to 0 if it is negative.

CC: libav-stable at libav.org
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

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

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c24a6c4..54c4814 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -569,6 +569,23 @@ static int avi_read_header(AVFormatContext *s)
                 av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
                 goto fail;
             }
+
+            if (ast->sample_size < 0) {
+                if (s->error_recognition & AV_EF_EXPLODE) {
+                    av_log(s, AV_LOG_ERROR,
+                           "Invalid sample_size %d at stream %d\n",
+                           ast->sample_size,
+                           stream_index);
+                    goto fail;
+                }
+                av_log(s, AV_LOG_WARNING,
+                       "Invalid sample_size %d at stream %d "
+                       "setting it to 0\n",
+                       ast->sample_size,
+                       stream_index);
+                ast->sample_size = 0;
+            }
+
             if (ast->sample_size == 0)
                 st->duration = st->nb_frames;
             ast->frame_offset = ast->cum_len;



More information about the ffmpeg-cvslog mailing list