diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-23 15:47:40 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-07 00:51:49 +0100 |
commit | 2eb05eaa682ec49eade91e358ace4e1415695686 (patch) | |
tree | 13edd827af445788fea94290aa5459e6737ec260 /libavformat/adxdec.c | |
parent | 88db6c2890a66c557dcb372c030bbebb955eeb48 (diff) | |
download | ffmpeg-2eb05eaa682ec49eade91e358ace4e1415695686.tar.gz |
adxdec: 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/adxdec.c')
-rw-r--r-- | libavformat/adxdec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index cf4453195e..0315ecb39d 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -109,6 +109,11 @@ static int adx_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } + if (par->sample_rate <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", par->sample_rate); + return AVERROR_INVALIDDATA; + } + par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id = s->iformat->raw_codec_id; par->bit_rate = par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; |