Commit c188f358 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/wavpack: Treat the first block coding too many channels as an error

Fixes memleak
Fixes: 236/8aeebc9ca49b91bf71c114dcefac56c154a3a563

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6b95da9a
......@@ -1016,7 +1016,7 @@ static int wavpack_decode_block(AVCodecContext *avctx, int block_no,
if (wc->ch_offset + s->stereo >= avctx->channels) {
av_log(avctx, AV_LOG_WARNING, "Too many channels coded in a packet.\n");
return (avctx->err_recognition & AV_EF_EXPLODE) ? AVERROR_INVALIDDATA : 0;
return ((avctx->err_recognition & AV_EF_EXPLODE) || !wc->ch_offset) ? AVERROR_INVALIDDATA : 0;
}
samples_l = frame->extended_data[wc->ch_offset];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment