diff --git a/libavformat/utils.c b/libavformat/utils.c index 524765aeb4..88f6f18f1f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4493,9 +4493,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) int i; AVStream **streams; - if (s->nb_streams >= FFMIN(s->max_streams, INT_MAX/sizeof(*streams))) { - if (s->max_streams < INT_MAX/sizeof(*streams)) - av_log(s, AV_LOG_ERROR, "Number of streams exceeds max_streams parameter (%d), see the documentation if you wish to increase it\n", s->max_streams); + if (s->nb_streams >= s->max_streams) { + av_log(s, AV_LOG_ERROR, "Number of streams exceeds max_streams parameter" + " (%d), see the documentation if you wish to increase it\n", + s->max_streams); return NULL; } streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams));