aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-10 20:15:13 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-02-03 15:59:14 +0100
commit198c8924c609e5d2d03b9d4889325d65d4a4cd64 (patch)
treecfa12ba0fe603c136b733b8e16a230fb8f5e5c3b
parent4535861ef8289e97e02d6c7c08eabd9454bbb63a (diff)
downloadffmpeg-198c8924c609e5d2d03b9d4889325d65d4a4cd64.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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6df3036371..b199ff23bf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3819,8 +3819,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;