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

Git pushed a commit to branch master
in repository ffmpeg.

commit 0d0f9a06ab554c65344329aa6fc73b800f55b351
Author:     Niklas Haas <[email protected]>
AuthorDate: Sun Jun 14 13:02:55 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Tue Jun 23 20:33:00 2026 +0200

    avformat/http: only re-use old connection if valid
    
    Otherwise, this might leak stale bytes that were already drained by the
    HTTP soft-seek attempt.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavformat/http.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 30748bb28d..ce98c01ae4 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -2169,14 +2169,16 @@ static int64_t http_seek_internal(URLContext *h, 
int64_t off, int whence, int fo
         s->hd = NULL;
     }
 
-    /* if it fails, continue on old connection */
     if ((ret = http_open_cnx(h, &options)) < 0) {
+        /* if it fails, continue on old connection if possible */
+        if (old_hd) {
+            memcpy(s->buffer, old_buf, old_buf_size);
+            s->buf_ptr = s->buffer;
+            s->buf_end = s->buffer + old_buf_size;
+            s->hd      = old_hd;
+            s->off     = old_off;
+        }
         av_dict_free(&options);
-        memcpy(s->buffer, old_buf, old_buf_size);
-        s->buf_ptr = s->buffer;
-        s->buf_end = s->buffer + old_buf_size;
-        s->hd      = old_hd;
-        s->off     = old_off;
         return ret;
     }
     av_dict_free(&options);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to