[FFmpeg-cvslog] takdec: ensure chan2 is a valid channel index
Andreas Cadhalpun
git at videolan.org
Wed Jun 17 22:09:34 CEST 2015
ffmpeg | branch: release/2.2 | Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> | Wed Jun 10 00:12:38 2015 +0200| [d6bde7be5f34126f0b70b0146dfc3415424de116] | committer: Michael Niedermayer
takdec: ensure chan2 is a valid channel index
If chan2 is not smaller than the number of channels, it can cause
segmentation faults due to dereferencing a NULL pointer.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 05c57ba2f42324da2fdc93d83d65bb68dd637613)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6bde7be5f34126f0b70b0146dfc3415424de116
---
libavcodec/takdec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 86ca3ac..cfc7ad5 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -800,6 +800,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data,
if (s->mcdparams[i].present) {
s->mcdparams[i].index = get_bits(gb, 2);
s->mcdparams[i].chan2 = get_bits(gb, 4);
+ if (s->mcdparams[i].chan2 >= avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR,
+ "invalid channel 2 (%d) for %d channel(s)\n",
+ s->mcdparams[i].chan2, avctx->channels);
+ return AVERROR_INVALIDDATA;
+ }
if (s->mcdparams[i].index == 1) {
if ((nbit == s->mcdparams[i].chan2) ||
(ch_mask & 1 << s->mcdparams[i].chan2))
More information about the ffmpeg-cvslog
mailing list