[FFmpeg-cvslog] avcodec/wavpackenc: Check the number of channels

Michael Niedermayer git at videolan.org
Fri Jan 15 16:37:58 CET 2016


ffmpeg | branch: release/2.7 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jan 11 18:58:08 2016 +0100| [858f43043f74278cb8f4f9967a1177348a528ca0] | committer: Michael Niedermayer

avcodec/wavpackenc: Check the number of channels

They are stored in a byte, thus more than 255 is not possible

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 59c915a403af32c4ff5126625b0cc7e38f4beff9)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/wavpackenc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index b387b36..0798fc5 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -128,6 +128,11 @@ static av_cold int wavpack_encode_init(AVCodecContext *avctx)
 
     s->avctx = avctx;
 
+    if (avctx->channels > 255) {
+        av_log(avctx, AV_LOG_ERROR, "Too many channels\n", avctx->channels);
+        return AVERROR(EINVAL);
+    }
+
     if (!avctx->frame_size) {
         int block_samples;
         if (!(avctx->sample_rate & 1))



More information about the ffmpeg-cvslog mailing list