diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-04 22:15:07 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-04 22:26:33 +0200 |
commit | 5f7e48a113918b59b50b88a80ee0c0dfc39b6fab (patch) | |
tree | a6f777824e6c256ebadd28cd26348c6cfcc1537b /libavcodec/on2avc.c | |
parent | e2e0c5b7f64d526907955b27e5682c8bf4de7700 (diff) | |
download | ffmpeg-5f7e48a113918b59b50b88a80ee0c0dfc39b6fab.tar.gz |
avcodec/on2avc: Check number of channels
Fixes out of array access
Fixes: asan_heap-oob_4da4f3_7_asan_heap-oob_4da4f3_173_Xmen_avc_500.vp6
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 550f3e9df3410b3dd975e590042c0d83e20a8da3)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/on2avc.c')
-rw-r--r-- | libavcodec/on2avc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c index ab6048b63e..e5e7cc3879 100644 --- a/libavcodec/on2avc.c +++ b/libavcodec/on2avc.c @@ -908,6 +908,11 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx) On2AVCContext *c = avctx->priv_data; int i; + if (avctx->channels > 2U) { + avpriv_request_sample(avctx, "Decoding more than 2 channels"); + return AVERROR_PATCHWELCOME; + } + c->avctx = avctx; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO |