avcodec_decode_audio: do not trust the channel layout, use the channel count.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 18 Jan 2013 00:28:44 +0000 (01:28 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 19 Jan 2013 15:18:08 +0000 (16:18 +0100)
Fixes memory corruption

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d270c3202539e8364c46410e15f7570800e33343)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/utils.c

index 8c0aa98..12265a9 100644 (file)
@@ -1809,7 +1809,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
      * extended_data are doing it correctly */
     if (*got_frame_ptr) {
         planar   = av_sample_fmt_is_planar(frame->format);
-        channels = av_get_channel_layout_nb_channels(frame->channel_layout);
+        channels = frame->channels;
         if (!(planar && channels > AV_NUM_DATA_POINTERS))
             frame->extended_data = frame->data;
     } else {