mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
avcodec/utils: Check that channel count is valid in avcodec_open2();
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
9c943e077b
commit
ea8785ceda
1 changed files with 6 additions and 0 deletions
|
|
@ -1617,6 +1617,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
|||
} else if (avctx->channel_layout) {
|
||||
avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
|
||||
}
|
||||
if (avctx->channels < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Specified number of channels %d is not supported\n",
|
||||
avctx->channels);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto free_and_end;
|
||||
}
|
||||
if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (avctx->width <= 0 || avctx->height <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue