mpegaudiodec: Validate that the number of channels fits at the given offset
authorMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 12:32:02 +0000 (15:32 +0300)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 4 Oct 2013 01:26:28 +0000 (03:26 +0200)
This is similar to the fix in 35cbc98b.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e9d61de96c113ee0ef8082833c7e682df0e23eec)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/mpegaudiodec.c

index fda0280..bd096df 100644 (file)
@@ -1936,7 +1936,8 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
 
         avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
 
-        if (ch + m->nb_channels > avctx->channels) {
+        if (ch + m->nb_channels > avctx->channels ||
+            s->coff[fr] + m->nb_channels > avctx->channels) {
             av_log(avctx, AV_LOG_ERROR, "frame channel count exceeds codec "
                                         "channel count\n");
             return AVERROR_INVALIDDATA;