Commit 9bbace1773 for ffmpeg
commit 9bbace177328332bd753d30856b59a6a552176ea
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Fri Nov 6 22:57:48 2026 +0100
avformat/rtsp: do not pass a media without stream to ff_real_parse_sdp_a_line()
Fixes: heap-buffer-overflow
Fixes: sRHeb0Z1vF6q
Found-by: SecBuddyF, Tencent KeenLab (CodeBuddy Security)
Heap out of array read Replicated through UnModified FFmpeg with ASAN
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 29f219c366..9bc389c452 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -743,7 +743,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
if (s->nb_streams > 0) {
rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1];
- if (rt->server_type == RTSP_SERVER_REAL)
+ if (rt->server_type == RTSP_SERVER_REAL && rtsp_st->stream_index >= 0)
ff_real_parse_sdp_a_line(s, rtsp_st->stream_index, p);
if (rtsp_st->dynamic_handler &&