summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-03 17:40:30 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-07 00:55:25 +0200
commitd0d9182d3e816f40ebf7dcfab9176050faa9b529 (patch)
treecac9f01b902a395eb90f6e6e15fa6197a467c308
parent320704f739e831b13f5c4e9a7770d46fa9d24bde (diff)
downloadffmpeg-d0d9182d3e816f40ebf7dcfab9176050faa9b529.tar.gz
mpc8: fix channel checks
fix heap array overflow Found-by: Piotr Bandurski <ami_stuff@o2.pl> Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 44c10168cff41c200825448b77cb8feff0d316c9) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mpc8.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index c37cd50497..652e824843 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -140,7 +140,8 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
c->frames = 1 << (get_bits(&gb, 3) * 2);
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+ avctx->channel_layout = (channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+ avctx->channels = channels;
if(vlc_initialized) return 0;
av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");