[FFmpeg-cvslog] avformat/utils: Print verbose error message if stream count exceeds max_streams
Michael Niedermayer
git at videolan.org
Fri Feb 3 17:42:05 EET 2017
ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Sat Dec 10 20:15:13 2016 +0100| [198c8924c609e5d2d03b9d4889325d65d4a4cd64] | committer: Michael Niedermayer
avformat/utils: Print verbose error message if stream count exceeds max_streams
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit f0bdd538712d8ed34120ab2b7bd1409fcc99fb45)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=198c8924c609e5d2d03b9d4889325d65d4a4cd64
---
libavformat/utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6df3036..b199ff2 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;
More information about the ffmpeg-cvslog
mailing list