summaryrefslogtreecommitdiff
path: root/libavformat/mvdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-10-23 17:06:45 +0200
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-07 00:51:49 +0100
commit2c818c3821e4e1646610112d4e01fdcc33071901 (patch)
treed235c4c89826ed948c6ce0af01818348463da5ab /libavformat/mvdec.c
parent074775462283e59657fbd18e76435371a2b80fda (diff)
downloadffmpeg-2c818c3821e4e1646610112d4e01fdcc33071901.tar.gz
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@googlemail.com>
Diffstat (limited to 'libavformat/mvdec.c')
-rw-r--r--libavformat/mvdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 80ef4b1569..f0a29ebe57 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;