diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-19 23:40:41 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-20 19:54:54 +0200 |
commit | ee5f0f1d355fa0fd9194ac97a2c8598c93ed328b (patch) | |
tree | 1adf7552dd9b5ec8f9d6d869e66b721242b82d5c /libavformat | |
parent | 8bd38ec5bde1d2691d6385975a2bad61538188bf (diff) | |
download | ffmpeg-ee5f0f1d355fa0fd9194ac97a2c8598c93ed328b.tar.gz |
rsd: limit number of channels
Negative values don't make sense and too large values can cause
overflows. For AV_CODEC_ID_ADPCM_THP this leads to a too small extradata
buffer being allocated, causing out-of-bounds writes.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rsd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/rsd.c b/libavformat/rsd.c index ee6fdfbeb1..5a56e72bb3 100644 --- a/libavformat/rsd.c +++ b/libavformat/rsd.c @@ -84,8 +84,10 @@ static int rsd_read_header(AVFormatContext *s) } par->channels = avio_rl32(pb); - if (!par->channels) + if (par->channels <= 0 || par->channels > INT_MAX / 36) { + av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", par->channels); return AVERROR_INVALIDDATA; + } avio_skip(pb, 4); // Bit depth par->sample_rate = avio_rl32(pb); |