mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
avcodec/avcodec: Check for more invalid channel layouts
In particular, check the provided channel layout for encoders without AVCodec.ch_layouts set. This fixes an infinite loop in the WavPack encoder (and maybe other issues in other encoders as well) in case the channel count is zero. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
859d9d70f9
commit
a06a2d8943
3 changed files with 14 additions and 10 deletions
|
|
@ -602,11 +602,6 @@ static int encode_preinit_audio(AVCodecContext *avctx)
|
|||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (avctx->codec->ch_layouts) {
|
||||
if (!av_channel_layout_check(&avctx->ch_layout)) {
|
||||
av_log(avctx, AV_LOG_WARNING, "Channel layout not specified correctly\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
for (i = 0; avctx->codec->ch_layouts[i].nb_channels; i++) {
|
||||
if (!av_channel_layout_compare(&avctx->ch_layout, &avctx->codec->ch_layouts[i]))
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue