[FFmpeg-cvslog] smacker: validate number of channels

Justin Ruggles git at videolan.org
Wed Oct 12 05:51:14 CEST 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Wed Sep 21 11:37:51 2011 -0400| [e190e453bd1e4d4b409ed3556b3a50d1087c15d7] | committer: Justin Ruggles

smacker: validate number of channels

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e190e453bd1e4d4b409ed3556b3a50d1087c15d7
---

 libavcodec/smacker.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 496bbb5..f3dec7f 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;



More information about the ffmpeg-cvslog mailing list