mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-12 18:10:13 +01:00
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user