Commit 17afe2331a for ffmpeg
commit 17afe2331ac3bcabbf0fe9c377e2c04ffab08642
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Fri Oct 2 03:56:00 2026 +0200
avformat/http: drop the old reply when seeking past the end
Close the connection and empty the buffer when a seek past the end is
answered without a request, so that neither the buffered bytes nor the
connection of the old reply are used at the new offset.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
diff --git a/libavformat/http.c b/libavformat/http.c
index 8ab144079c..e27e80f484 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -2226,8 +2226,12 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
/* do not try to make a new connection if seeking past the end of the file */
if (s->end_off || s->filesize != UINT64_MAX) {
uint64_t end_pos = s->end_off ? s->end_off : s->filesize;
- if (s->off >= end_pos)
+ if (s->off >= end_pos) {
+ /* nothing of the old reply belongs to this offset */
+ ffurl_closep(&s->hd);
+ s->buf_ptr = s->buf_end = s->buffer;
return s->off;
+ }
}
/* if the location changed (redirect), revert to the original uri */