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>
This commit is contained in:
Michael Niedermayer 2016-01-11 18:58:08 +01:00
parent 26757b0279
commit 59c915a403
1 changed files with 5 additions and 0 deletions

View File

@ -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))