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

Git pushed a commit to branch master
in repository ffmpeg.

commit cbed9900216d4885e089a59eedd6893104c4d6bc
Author:     Niklas Haas <[email protected]>
AuthorDate: Mon Jun 29 17:01:29 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Mon Jul 27 17:05:20 2026 +0000

    avformat/libcurl: guard against unexpected reply content-range
    
    Harden against malicious or badly misbehaving servers.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavformat/libcurl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c
index 6ea66c118c..d9f1e1884d 100644
--- a/libavformat/libcurl.c
+++ b/libavformat/libcurl.c
@@ -299,6 +299,19 @@ static size_t header_callback(char *ptr, size_t size, 
size_t nitems, void *userd
 
     pthread_mutex_lock(&c->mutex);
     if (status >= 200 && status < 300) {
+        int64_t content_start = status == 206 ? c->hdr_content_start : 0;
+        if (c->probed && c->seekable && content_start != c->request_start) {
+            av_log(c->h, AV_LOG_ERROR, "Server sent back unexpected reply "
+                   "with offset %"PRId64" (expected %"PRId64")\n",
+                   content_start, c->request_start);
+            c->stream_ok = 0;
+            if (!c->error)
+                c->error = AVERROR(EIO);
+            pthread_cond_broadcast(&c->cond);
+            pthread_mutex_unlock(&c->mutex);
+            return len;
+        }
+
         c->stream_ok = 1;
         /* Capture the post-redirect URL, this is exposed as "location" 
AVOption
          * for compatibility with http.c. */

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

Reply via email to