summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-11 18:58:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-11 18:58:08 +0100
commit59c915a403af32c4ff5126625b0cc7e38f4beff9 (patch)
tree897412c5c4ee48b879fbd1cd00ece803c20101eb /libavcodec
parent26757b0279b4b93c6066c2151d4d3dbd2ec266bf (diff)
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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wavpackenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 05e8f2bec9..f4e710d5b3 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))