[FFmpeg-cvslog] twinvq: check bitrate for validity avoid division by 0
Michael Niedermayer
git at videolan.org
Fri Nov 9 18:53:01 CET 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov 9 18:45:41 2012 +0100| [b8dc5f8bb3b14bfd2289a0444c7b706299555d97] | committer: Michael Niedermayer
twinvq: check bitrate for validity avoid division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8dc5f8bb3b14bfd2289a0444c7b706299555d97
---
libavcodec/twinvq.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index f4eba4d..7281d9c 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -1142,6 +1142,11 @@ static av_cold int twin_decode_init(AVCodecContext *avctx)
ibps = avctx->bit_rate / (1000 * avctx->channels);
+ if (ibps > 255) {
+ av_log(avctx, AV_LOG_ERROR, "unsupported per channel bitrate %dkbps\n", ibps);
+ return AVERROR_INVALIDDATA;
+ }
+
switch ((isampf << 8) + ibps) {
case (8 <<8) + 8: tctx->mtab = &mode_08_08; break;
case (11<<8) + 8: tctx->mtab = &mode_11_08; break;
More information about the ffmpeg-cvslog
mailing list