Browse Source

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 f0bdd53871)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.11
Michael Niedermayer 9 years ago
parent
commit
1825f7670a
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavformat/utils.c

+ 4
- 1
libavformat/utils.c View File

@@ -3764,8 +3764,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
int i; int i;
AVStream **streams; 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; return NULL;
}
streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams)); streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams));
if (!streams) if (!streams)
return NULL; return NULL;


Loading…
Cancel
Save