aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/smacker.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-21 11:37:51 -0400
committerMichael Niedermayer <michaelni@gmx.at>2011-11-04 01:07:39 +0100
commit7f7b2e89e270801ea5918afa1432d3bb32f6ebc7 (patch)
tree111e1b93fb03ac0e54757229e7d7eca7a8dc74be /libavcodec/smacker.c
parent73f85eae68b6d40cad1cd53b04a6ed1a31cced1b (diff)
downloadffmpeg-7f7b2e89e270801ea5918afa1432d3bb32f6ebc7.tar.gz
smacker: validate number of channels
(cherry picked from commit e190e453bd1e4d4b409ed3556b3a50d1087c15d7) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r--libavcodec/smacker.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index be4bc2336f..30dbaa7dae 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -560,6 +560,10 @@ static av_cold int decode_end(AVCodecContext *avctx)
static av_cold int smka_decode_init(AVCodecContext *avctx)
{
+ if (avctx->channels < 1 || avctx->channels > 2) {
+ av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
+ return AVERROR(EINVAL);
+ }
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? AV_SAMPLE_FMT_U8 : AV_SAMPLE_FMT_S16;
return 0;