aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-01-25 21:30:04 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-03-24 10:39:03 +0100
commitd116540d06aeebdc495ef43c14d58f95ec6556a9 (patch)
tree14322c94047bad26dc2732dc48a8f0fad245e334
parente5ea21a58063e1628a2892ed76e5725ba0bfd0cd (diff)
downloadffmpeg-d116540d06aeebdc495ef43c14d58f95ec6556a9.tar.gz
avformat/rtsp: Check number of streams in sdp_parse_line()
Fixes: OOM Found-by: Michael Hanselmann <public@hansmi.ch> Reviewed-by: Michael Hanselmann <public@hansmi.ch> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 497c9b0cce559d43607bbbd679fe42f1d7e9040e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rtsp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a3f1e40983..8c8381c055 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -446,7 +446,10 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
} else if (!strcmp(st_type, "text")) {
codec_type = AVMEDIA_TYPE_SUBTITLE;
}
- if (codec_type == AVMEDIA_TYPE_UNKNOWN || !(rt->media_type_mask & (1 << codec_type))) {
+ if (codec_type == AVMEDIA_TYPE_UNKNOWN ||
+ !(rt->media_type_mask & (1 << codec_type)) ||
+ rt->nb_rtsp_streams >= s->max_streams
+ ) {
s1->skip_media = 1;
return;
}