Browse Source

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>
tags/n3.3
Andreas Cadhalpun 9 years ago
parent
commit
2c818c3821
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavformat/mvdec.c

+ 4
- 0
libavformat/mvdec.c View File

@@ -317,6 +317,10 @@ static int mv_read_header(AVFormatContext *avctx)
ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
ast->nb_frames = vst->nb_frames; ast->nb_frames = vst->nb_frames;
ast->codecpar->sample_rate = avio_rb32(pb); 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); avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
if (set_channels(avctx, ast, avio_rb32(pb)) < 0) if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;


Loading…
Cancel
Save