summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-11-18 17:00:30 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-08 18:25:30 +0100
commit1296f844955e513d19051c962656f829479d4fb9 (patch)
treebbac8b6e416a390ba20b876c5fc21f7ba018ea44 /libavformat/utils.c
parentda5c8284c02c4ccc3596bc52d54a10166708094f (diff)
avformat: Add max_streams option
This allows user apps to stop OOM due to excessive number of streams Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5f69b6bce9..9e979a7c79 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4217,7 +4217,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
int i;
AVStream **streams;
- if (s->nb_streams >= INT_MAX/sizeof(*streams))
+ if (s->nb_streams >= FFMIN(s->max_streams, INT_MAX/sizeof(*streams)))
return NULL;
streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams));
if (!streams)