]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpegaudiodec_template/mp3on4: check that all channels have been decoded befor...
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Jan 2014 19:53:42 +0000 (20:53 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 14 Jan 2014 19:56:08 +0000 (20:56 +0100)
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f80bf9a259e_5774_id5_1.mp4
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegaudiodec_template.c

index be8ce6d56eb1d793c1614eac406f17e5fb106a4c..f5031925ed1c25dcb23f2d4847e25689d9801010 100644 (file)
@@ -1962,6 +1962,10 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data,
 
         avctx->bit_rate += m->bit_rate;
     }
+    if (ch != avctx->channels) {
+        av_log(avctx, AV_LOG_ERROR, "failed to decode all channels\n");
+        return AVERROR_INVALIDDATA;
+    }
 
     /* update codec info */
     avctx->sample_rate = s->mp3decctx[0]->sample_rate;