mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-14 03:04:53 +00:00
avcodec/utils: Check channels fully earlier
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
270f94e132
commit
83f2555e5f
@ -678,8 +678,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
|||||||
if (av_codec_is_decoder(codec))
|
if (av_codec_is_decoder(codec))
|
||||||
av_freep(&avctx->subtitle_header);
|
av_freep(&avctx->subtitle_header);
|
||||||
|
|
||||||
if (avctx->channels > FF_SANE_NB_CHANNELS) {
|
if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels);
|
av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", avctx->channels);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto free_and_end;
|
goto free_and_end;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user