diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-09-21 11:37:51 -0400 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2012-03-18 17:50:41 +0100 |
commit | ef7a4df4584db51a97edea3b1140661faf4ddf56 (patch) | |
tree | caf581c5193111ea30013696a1061a4053ea63da | |
parent | 3b7a1ba90ec94fe052b6ea085ae6f3f3bfd9ba27 (diff) | |
download | ffmpeg-ef7a4df4584db51a97edea3b1140661faf4ddf56.tar.gz |
smacker: validate number of channels
(cherry picked from commit e190e453bd1e4d4b409ed3556b3a50d1087c15d7)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavcodec/smacker.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 1fa40def62..33ea7b95d6 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -559,6 +559,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; |