diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-12-10 22:15:13 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-26 02:34:12 +0300 |
commit | 9519b2560e1839644a74162ee52f2116532d964a (patch) | |
tree | d3f45d3daef984934bb2f9fd440b96cdadb1c148 /libavformat | |
parent | 3e3e095fc90306b56ed3496d2000676092c5bfb7 (diff) |
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>
Diffstat (limited to 'libavformat')
-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 20712bb781..1df0ec0faa 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4213,8 +4213,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; |