aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-11 18:58:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-15 17:39:04 +0100
commit4865d66b76f7bb85b837bcadb9f9d7b7337f137a (patch)
tree1cd6c69e610cd02872b4148959326c683d4bb2a4
parent71b640230ec891f0dc2803b776faa1b6322da1b2 (diff)
downloadffmpeg-4865d66b76f7bb85b837bcadb9f9d7b7337f137a.tar.gz
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@niedermayer.cc> (cherry picked from commit 59c915a403af32c4ff5126625b0cc7e38f4beff9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/wavpackenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index ecc4a2eea2..2d98e53b95 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))