diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-10 20:15:13 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-08 21:17:50 +0100 |
commit | 1825f7670a8863419ffb10f6a6bb4b4b44c876dc (patch) | |
tree | 41a1983bcf99a651ad8e297e22776e362e02fe53 | |
parent | 2647ca45814a4ba60643a312f8caf0891fc3fc04 (diff) | |
download | ffmpeg-1825f7670a8863419ffb10f6a6bb4b4b44c876dc.tar.gz |
avformat/utils: Print verbose error message if stream count exceeds max_streams
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit f0bdd538712d8ed34120ab2b7bd1409fcc99fb45)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 4f159d6bcb..abc90c3c70 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3764,8 +3764,11 @@ 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->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); return NULL; + } streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams)); if (!streams) return NULL; |