This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new f5d4fd186c avformat/rtsp: limit the number of redirects
f5d4fd186c is described below

commit f5d4fd186c68913240c4f6e9cda98443e1518b34
Author:     BapToutatis <[email protected]>
AuthorDate: Tue Oct 6 06:22:28 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Fri Oct 9 17:34:46 2026 +0000

    avformat/rtsp: limit the number of redirects
    
    Fixes: 2OgPp3duxpWM
    Found-by: BapToutatis
    Endless redirect loop Replicated through UnModified FFmpeg with rogue RTSP 
servers
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/rtsp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index cdf7b7c389..eef1e10eb2 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1935,6 +1935,7 @@ int ff_rtsp_connect(AVFormatContext *s)
     int port, err, tcp_fd;
     RTSPMessageHeader reply1, *reply = &reply1;
     int lower_transport_mask = 0;
+    int redirects = 0;
     int default_port = RTSP_DEFAULT_PORT;
     int https_tunnel = 0;
     char real_challenge[64] = "";
@@ -2243,6 +2244,11 @@ redirect:
     if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
         int ret;
 
+        if (redirects++ >= 8 /* MAX_RTSP_REDIRECTS */) {
+            av_log(s, AV_LOG_ERROR, "Too many RTSP redirects\n");
+            err = AVERROR(EIO);
+            goto fail2;
+        }
         if (!rtsp_url_same_origin(s->url, reply->location)) {
             memset(rt->auth, 0, sizeof(rt->auth));
             memset(&rt->auth_state, 0, sizeof(rt->auth_state));

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to