[FFmpeg-cvslog] mvdec: validate sample_rate

Andreas Cadhalpun git at videolan.org
Mon Nov 7 01:54:01 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Oct 23 17:06:45 2016 +0200| [2c818c3821e4e1646610112d4e01fdcc33071901] | committer: Andreas Cadhalpun

mvdec: validate sample_rate

A negative sample rate doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/mvdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 80ef4b1..f0a29eb 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -317,6 +317,10 @@ static int mv_read_header(AVFormatContext *avctx)
         ast->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
         ast->nb_frames          = vst->nb_frames;
         ast->codecpar->sample_rate = avio_rb32(pb);
+        if (ast->codecpar->sample_rate <= 0) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid sample rate %d\n", ast->codecpar->sample_rate);
+            return AVERROR_INVALIDDATA;
+        }
         avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
         if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
             return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list