[FFmpeg-cvslog] rsd: limit number of channels
Andreas Cadhalpun
git at videolan.org
Sun Nov 27 01:41:15 EET 2016
ffmpeg | branch: release/3.0 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Wed Oct 19 23:40:41 2016 +0200| [45b18fbb9a7729c91d69d6359a782a0135b5f2b8] | committer: Andreas Cadhalpun
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 at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit ee5f0f1d355fa0fd9194ac97a2c8598c93ed328b)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45b18fbb9a7729c91d69d6359a782a0135b5f2b8
---
libavformat/rsd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index dd1f372..c773c0a 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -84,8 +84,10 @@ static int rsd_read_header(AVFormatContext *s)
}
codec->channels = avio_rl32(pb);
- if (!codec->channels)
+ if (codec->channels <= 0 || codec->channels > INT_MAX / 36) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of channels: %d\n", codec->channels);
return AVERROR_INVALIDDATA;
+ }
avio_skip(pb, 4); // Bit depth
codec->sample_rate = avio_rl32(pb);
More information about the ffmpeg-cvslog
mailing list