Quoting James Almer (2022-01-13 03:07:13)
> From: Anton Khirnov <an...@khirnov.net>
> 
> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
> Signed-off-by: James Almer <jamr...@gmail.com>
> ---
>  libavcodec/wavpack.c    | 51 ++++++++++++++++++-----------------------
>  libavcodec/wavpackenc.c | 29 ++++++++++++-----------
>  2 files changed, 37 insertions(+), 43 deletions(-)
> 
> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
> index 6b2ec19bf1..e0350ce732 100644
> --- a/libavcodec/wavpack.c
> +++ b/libavcodec/wavpack.c
> @@ -1512,36 +1509,32 @@ static int wavpack_decode_block(AVCodecContext 
> *avctx, int block_no,
>          new_samplerate *= rate_x;
>  
>          if (multiblock) {
> -            if (chan)
> -                new_channels = chan;
> -            if (chmask)
> -                new_chmask = chmask;
> +            if (chmask) {
> +                av_channel_layout_from_mask(&new_ch_layout, chmask);
> +                if (chan && new_ch_layout.nb_channels != chan) {
> +                    av_log(avctx, AV_LOG_ERROR, "Channel mask does not match 
> the channel count\n");
> +                    return AVERROR_INVALIDDATA;
> +                }
> +            } else
> +                av_channel_layout_copy(&new_ch_layout, &avctx->ch_layout);

user-supplied layout can be custom, so you should probably check this
and the second copy below


-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to