aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-20 10:25:05 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:43 +0100
commitf34c2a9f941c1f7c13a3b54dd203618612674037 (patch)
tree7f84468f9f4ca0133a34e1812ce52b5c7363b795 /libavcodec
parenta600c6fa02f982b4b5469ee5d91f2f433c8c2e86 (diff)
downloadffmpeg-f34c2a9f941c1f7c13a3b54dd203618612674037.tar.gz
avcodec/utils: Check channels fully earlier
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 83f2555e5ff571cbf5c226a920602e91228039ab) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index cfe40c59f7..b7c47af89e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -674,8 +674,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (av_codec_is_decoder(codec))
av_freep(&avctx->subtitle_header);
- if (avctx->channels > FF_SANE_NB_CHANNELS) {
- av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->channels);
+ if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", avctx->channels);
ret = AVERROR(EINVAL);
goto free_and_end;
}